Skip to content

Commit

Permalink
ndb_redis: redis_cmd() check reply type to detect command errors
Browse files Browse the repository at this point in the history
fix #2300

(cherry picked from commit d00b147)
  • Loading branch information
linuxmaniac committed May 7, 2020
1 parent 4061a1d commit 13f4b10
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/modules/ndb_redis/redis_client.c
Expand Up @@ -953,6 +953,14 @@ int redisc_exec(str *srv, str *res, str *cmd, ...)
goto error_exec;
}
}

LM_DBG("rpl->rplRedis->type:%d\n", rpl->rplRedis->type);
if(rpl->rplRedis->type == REDIS_REPLY_ERROR) {
LM_ERR("Redis error:%.*s\n",
(int)rpl->rplRedis->len, rpl->rplRedis->str);
goto error_exec;
}

if (check_cluster_reply(rpl->rplRedis, &rsrv)) {
LM_DBG("rsrv->ctxRedis = %p\n", rsrv->ctxRedis);
if(rsrv->ctxRedis==NULL)
Expand Down Expand Up @@ -987,6 +995,13 @@ int redisc_exec(str *srv, str *res, str *cmd, ...)
goto error_exec;
}
}

LM_DBG("rpl->rplRedis->type:%d\n", rpl->rplRedis->type);
if(rpl->rplRedis->type == REDIS_REPLY_ERROR) {
LM_ERR("Redis error:%.*s\n",
(int)rpl->rplRedis->len, rpl->rplRedis->str);
goto error_exec;
}
}
cmd->s[cmd->len] = c;
rsrv->disable.consecutive_errors = 0;
Expand Down

0 comments on commit 13f4b10

Please sign in to comment.