in common/redistran.cpp [24:64]
bool RedisTransactioner::exec()
{
using namespace std;
RedisReply r(m_db, "EXEC");
redisReply *reply = r.getContext();
size_t size = reply->elements;
// if meet error in transaction
if (reply->type != REDIS_REPLY_ARRAY)
{
return false;
}
if (size != m_expectedResults.size())
throw system_error(make_error_code(errc::io_error),
"Got to different number of answers!");
clearResults();
for (unsigned int i = 0; i < size; i++)
{
int expectedType = m_expectedResults.front();
m_expectedResults.pop_front();
if (expectedType != reply->element[i]->type)
{
SWSS_LOG_ERROR("Expected to get redis type %d got type %d",
expectedType, reply->element[i]->type);
throw system_error(make_error_code(errc::io_error),
"Got unexpected result");
}
}
for (size_t i = 0; i < size; i++)
m_results.push_back(reply->element[i]);
/* Free only the array memory */
r.release();
free(reply->element);
free(reply);
return true;
}