diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-06-16 13:47:18 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-06-16 13:47:18 +0100 |
commit | 2fb4f616ceb7d4121b3a1cbad591e1fa68d71475 (patch) | |
tree | 572ca8491082622133a61f6e398af33646c92cf7 | |
parent | 6b70e518c1f17e93fe77bddb3f866d3d9b615be1 (diff) | |
download | rspamd-2fb4f616ceb7d4121b3a1cbad591e1fa68d71475.tar.gz rspamd-2fb4f616ceb7d4121b3a1cbad591e1fa68d71475.zip |
[Fix] More and more fixes to redis states
-rw-r--r-- | src/libstat/backends/redis_backend.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c index 4b11aca5a..d4097fff3 100644 --- a/src/libstat/backends/redis_backend.c +++ b/src/libstat/backends/redis_backend.c @@ -712,12 +712,16 @@ rspamd_redis_timeout (gint fd, short what, gpointer d) rspamd_upstream_name (rt->selected)); rspamd_upstream_fail (rt->selected); - if (rt->conn_state == RSPAMD_REDIS_REQUEST_SENT) { + if (rt->conn_state == RSPAMD_REDIS_REQUEST_SENT && rt->task) { rspamd_session_remove_event (task->s, rspamd_redis_fin, rt); } rt->conn_state = RSPAMD_REDIS_TERMINATED; - redisAsyncFree (rt->redis); + + if (rt->redis) { + redisAsyncFree (rt->redis); + } + rt->redis = NULL; REF_RELEASE (rt); } @@ -1436,6 +1440,9 @@ rspamd_redis_get_stat (gpointer runtime, st = rt->ctx->stat_elt->ud; if (rt->redis) { + if (rt->conn_state == RSPAMD_REDIS_REQUEST_SENT && rt->task) { + rspamd_session_remove_event (rt->task->s, rspamd_redis_fin, rt); + } event_del (&rt->timeout_event); rt->conn_state = RSPAMD_REDIS_TERMINATED; redisAsyncFree (rt->redis); |