[sr-dev] git:master:d00b1470: ndb_redis: redis_cmd() check reply type to detect command errors

Victor Seva linuxmaniac at torreviejawireless.org
Thu May 7 13:09:24 CEST 2020


Module: kamailio
Branch: master
Commit: d00b14704805d728f5a845a6af900eff1ed372ac
URL: https://github.com/kamailio/kamailio/commit/d00b14704805d728f5a845a6af900eff1ed372ac

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2020-05-07T13:09:15+02:00

ndb_redis: redis_cmd() check reply type to detect command errors

fix #2300

---

Modified: src/modules/ndb_redis/redis_client.c

---

Diff:  https://github.com/kamailio/kamailio/commit/d00b14704805d728f5a845a6af900eff1ed372ac.diff
Patch: https://github.com/kamailio/kamailio/commit/d00b14704805d728f5a845a6af900eff1ed372ac.patch

---

diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c
index edeee8d597..44460aa2fd 100644
--- a/src/modules/ndb_redis/redis_client.c
+++ b/src/modules/ndb_redis/redis_client.c
@@ -950,6 +950,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)
@@ -984,6 +992,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;
+		}
 	}
 	STR_ZTOV(cmd->s[cmd->len], c);
 	rsrv->disable.consecutive_errors = 0;




More information about the sr-dev mailing list