summaryrefslogtreecommitdiffstats
path: root/src/libstat
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-16 12:07:18 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-06-16 12:07:18 +0100
commit32affb821c02201db7f30c5d8206439932e084be (patch)
treeb980e86abb6a5c84ab0fcc564b136afd6f3eed89 /src/libstat
parente4f16f2eaa5b32eef75076e86a3ccf0d79b3aa08 (diff)
downloadrspamd-32affb821c02201db7f30c5d8206439932e084be.tar.gz
rspamd-32affb821c02201db7f30c5d8206439932e084be.zip
[Fix] Fix redis timeout events handling
Diffstat (limited to 'src/libstat')
-rw-r--r--src/libstat/backends/redis_backend.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c
index a2924d054..5f6eecdcf 100644
--- a/src/libstat/backends/redis_backend.c
+++ b/src/libstat/backends/redis_backend.c
@@ -705,17 +705,19 @@ rspamd_redis_timeout (gint fd, short what, gpointer d)
task = rt->task;
+ REF_RETAIN (rt);
msg_err_task_check ("connection to redis server %s timed out",
rspamd_upstream_name (rt->selected));
rspamd_upstream_fail (rt->selected);
- if (rt->conn_state != RSPAMD_REDIS_CONNECTED) {
+ if (rt->conn_state == RSPAMD_REDIS_CONNECTED) {
rspamd_session_remove_event (task->s, rspamd_redis_fin, rt);
}
rt->conn_state = RSPAMD_REDIS_TIMEDOUT;
redisAsyncFree (rt->redis);
rt->redis = NULL;
+ REF_RELEASE (rt);
}
/* Called when we have connected to the redis server and got stats */
@@ -1088,6 +1090,10 @@ rspamd_redis_init (struct rspamd_stat_ctx *ctx,
static void
rspamd_redis_runtime_dtor (struct redis_stat_runtime *rt)
{
+ if (event_get_base (&rt->timeout_event)) {
+ event_del (&rt->timeout_event);
+ }
+
g_slice_free1 (sizeof (*rt), rt);
}