[sr-dev] git:5.3:39fce673: ndb_redis: redis_cmd() check reply type to detect command errors

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


Module: kamailio
Branch: 5.3
Commit: 39fce673e50a52dbb0b1c8c786c98b15e8bdfeb7
URL: https://github.com/kamailio/kamailio/commit/39fce673e50a52dbb0b1c8c786c98b15e8bdfeb7

Author: Victor Seva <linuxmaniac at torreviejawireless.org>
Committer: Victor Seva <linuxmaniac at torreviejawireless.org>
Date: 2020-05-07T13:11:03+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/39fce673e50a52dbb0b1c8c786c98b15e8bdfeb7.diff
Patch: https://github.com/kamailio/kamailio/commit/39fce673e50a52dbb0b1c8c786c98b15e8bdfeb7.patch

---

diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c
index a4531801b4..acdc978768 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