Module: kamailio
Branch: 5.8
Commit: 60fd6c2622c9c5edbe82908c0e461d646225c8a6
URL:
https://github.com/kamailio/kamailio/commit/60fd6c2622c9c5edbe82908c0e461d6…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2024-03-20T13:16:29+01:00
ndb_redis: break on finding a server via sentinel inside redisc_reconnect_server()
(cherry picked from commit 951ab118bb7d9955f8e69b66bec1f0c107d474a2)
---
Modified: src/modules/ndb_redis/redis_client.c
---
Diff:
https://github.com/kamailio/kamailio/commit/60fd6c2622c9c5edbe82908c0e461d6…
Patch:
https://github.com/kamailio/kamailio/commit/60fd6c2622c9c5edbe82908c0e461d6…
---
diff --git a/src/modules/ndb_redis/redis_client.c b/src/modules/ndb_redis/redis_client.c
index dbbaecbcebe..c9280991ff3 100644
--- a/src/modules/ndb_redis/redis_client.c
+++ b/src/modules/ndb_redis/redis_client.c
@@ -533,6 +533,7 @@ int redisc_reconnect_server(redisc_server_t *rsrv)
for(i = 0; i < sentinels_count; i++) {
char *sentinelAddr = sentinels[i];
char *pos;
+ int srvfound = 0;
redisContext *redis;
redisReply *res, *res2;
@@ -555,6 +556,7 @@ int redisc_reconnect_server(redisc_server_t *rsrv)
port = atoi(res->element[1]->str);
LOG(ndb_redis_debug, "sentinel replied: %s:%d\n", addr,
port);
+ srvfound = 1;
}
} else {
res = redisCommand(
@@ -578,9 +580,13 @@ int redisc_reconnect_server(redisc_server_t *rsrv)
}
LOG(ndb_redis_debug, "slave for %s: %s:%d\n",
sentinel_group, addr, port);
+ srvfound = 1;
}
}
}
+ if(srvfound == 1) {
+ break;
+ }
}
}