Browse Source

* allow redis source/backend fail on start

master
Alex 'AdUser' Z 7 years ago
parent
commit
694624036c
  1. 14
      src/backends/redis.c
  2. 8
      src/sources/redis.c

14
src/backends/redis.c

@ -91,8 +91,10 @@ static bool
redis_disconnect(cfg_t *cfg) {
assert(cfg != NULL);
if (cfg->conn) {
redisFree(cfg->conn);
cfg->conn = NULL;
}
return true;
}
@ -170,10 +172,11 @@ bool
start(cfg_t *cfg) {
assert(cfg != NULL);
if (cfg->shared && usage_inc(cfg->name) > 1)
return true;
if (cfg->shared)
usage_inc(cfg->name);
return redis_connect(cfg);
redis_connect(cfg); /* may fail */
return true;
}
bool
@ -181,9 +184,10 @@ stop(cfg_t *cfg) {
assert(cfg != NULL);
if (cfg->shared && usage_dec(cfg->name) > 0)
return true;
return true; /* skip disconnect, if not last user */
return redis_disconnect(cfg);
redis_disconnect(cfg);
return true;
}
bool

8
src/sources/redis.c

@ -99,8 +99,10 @@ static bool
redis_disconnect(cfg_t *cfg) {
assert(cfg != NULL);
if (cfg->conn) {
redisFree(cfg->conn);
cfg->conn = NULL;
}
return true;
}
@ -180,14 +182,16 @@ bool
start(cfg_t *cfg) {
assert(cfg != NULL);
return redis_connect(cfg);
redis_connect(cfg); /* may fail */
return true;
}
bool
stop(cfg_t *cfg) {
assert(cfg != NULL);
return redis_disconnect(cfg);
redis_disconnect(cfg);
return true;
}
bool

Loading…
Cancel
Save