[sr-dev] git:5.2:13f4b108: ndb_redis: redis_cmd() check reply type to detect command errors
Victor Seva
linuxmaniac at torreviejawireless.org
Thu May 7 13:12:56 CEST 2020
Module: kamailio
Branch: 5.2
Commit: 13f4b108e1a424c42121f752de91fdeca8c0480a
URL: https://github.com/kamailio/kamailio/commit/13f4b108e1a424c42121f752de91fdeca8c0480a
Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2020-05-07T13:11:27+02:00
ndb_redis: redis_cmd() check reply type to detect command errors
fix #2300
(cherry picked from commit d00b14704805d728f5a845a6af900eff1ed372ac)
---
Modified: src/modules/ndb_redis/redis_client.c
---
Diff: https://github.com/kamailio/kamailio/commit/13f4b108e1a424c42121f752de91fdeca8c0480a.diff
Patch: https://github.com/kamailio/kamailio/commit/13f4b108e1a424c42121f752de91fdeca8c0480a.patch
---
diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c
index 7e3ddb0d8c..f2dbc82244 100644
--- a/src/modules/ndb_redis/redis_client.c
+++ b/src/modules/ndb_redis/redis_client.c
@@ -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)
@@ -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;
More information about the sr-dev
mailing list