diff options
-rw-r--r-- | src/libserver/redis_pool.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libserver/redis_pool.c b/src/libserver/redis_pool.c index 1efc4f743..ef5951cfa 100644 --- a/src/libserver/redis_pool.c +++ b/src/libserver/redis_pool.c @@ -115,11 +115,15 @@ rspamd_redis_pool_conn_dtor (struct rspamd_redis_pool_connection *conn) event_del (&conn->timeout); } - if (conn->ctx) { + if (conn->ctx && !(conn->ctx->c->flags & REDIS_FREEING)) { + redisAsyncContext *ac = conn->ctx; + /* To prevent on_disconnect here */ conn->active = TRUE; g_hash_table_remove (conn->elt->pool->elts_by_ctx, conn->ctx); - redisAsyncFree (conn->ctx); + conn->ctx = NULL; + ac->onDisconnect = NULL; + redisAsyncFree (ac); } g_queue_unlink (conn->elt->inactive, conn->entry); |