Module: kamailio Branch: master Commit: f56776826584de2dd0023bc3185107d3ff9491bb URL: https://github.com/kamailio/kamailio/commit/f56776826584de2dd0023bc3185107d3...
Author: Vicente Hernando vhernando@systemonenoc.com Committer: Vicente Hernando vhernando@systemonenoc.com Date: 2015-04-14T11:57:13+02:00
ndb_redis: init_without_redis continue only if connection or starting commands fail.
---
Modified: modules/ndb_redis/ndb_redis_mod.c Modified: modules/ndb_redis/redis_client.c
---
Diff: https://github.com/kamailio/kamailio/commit/f56776826584de2dd0023bc3185107d3... Patch: https://github.com/kamailio/kamailio/commit/f56776826584de2dd0023bc3185107d3...
---
diff --git a/modules/ndb_redis/ndb_redis_mod.c b/modules/ndb_redis/ndb_redis_mod.c index 525c108..c3c71f6 100644 --- a/modules/ndb_redis/ndb_redis_mod.c +++ b/modules/ndb_redis/ndb_redis_mod.c @@ -43,6 +43,7 @@ MODULE_VERSION
int redis_srv_param(modparam_t type, void *val); int init_without_redis = 0; + static int w_redis_cmd3(struct sip_msg* msg, char* ssrv, char* scmd, char* sres); static int w_redis_cmd4(struct sip_msg* msg, char* ssrv, char* scmd, @@ -115,15 +116,8 @@ static int child_init(int rank)
if(redisc_init()<0) { - if (init_without_redis==1) - { - LM_WARN("failed to initialize redis connections, but initializing module anyway\n"); - return 0; - } - else { - LM_ERR("failed to initialize redis connections\n"); - return -1; - } + LM_ERR("failed to initialize redis connections\n"); + return -1; } return 0; } diff --git a/modules/ndb_redis/redis_client.c b/modules/ndb_redis/redis_client.c index 0476ed2..02aa7b8 100644 --- a/modules/ndb_redis/redis_client.c +++ b/modules/ndb_redis/redis_client.c @@ -41,6 +41,8 @@ static redisc_server_t *_redisc_srv_list=NULL;
static redisc_reply_t *_redisc_rpl_list=NULL;
+extern int init_without_redis; + /** * */ @@ -118,6 +120,12 @@ int redisc_init(void) LM_ERR("error communicating with redis server [%.*s] (%s:%d/%d): %s\n", rsrv->sname->len, rsrv->sname->s, addr, port, db, rsrv->ctxRedis->errstr); } + if (init_without_redis==1) + { + LM_WARN("failed to initialize redis connections, but initializing module anyway.\n"); + return 0; + } + return -1; err: if (unix_sock_path != NULL) { @@ -127,6 +135,12 @@ int redisc_init(void) LM_ERR("failed to connect to redis server [%.*s] (%s:%d/%d)\n", rsrv->sname->len, rsrv->sname->s, addr, port, db); } + if (init_without_redis==1) + { + LM_WARN("failed to initialize redis connections, but initializing module anyway.\n"); + return 0; + } + return -1; }