From: Vsevolod Stakhov Date: Sat, 14 Jan 2017 12:39:50 +0000 (+0000) Subject: [Minor] Add more sanity checks to redis pool X-Git-Tag: 1.5.0~344 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=48bb5551ff24e89228d56bb08ab45281dc3d6f78;p=rspamd.git [Minor] Add more sanity checks to redis pool --- diff --git a/src/libserver/redis_pool.c b/src/libserver/redis_pool.c index 4e1a788ad..6aa4b6565 100644 --- a/src/libserver/redis_pool.c +++ b/src/libserver/redis_pool.c @@ -176,6 +176,7 @@ rspamd_redis_conn_timeout (gint fd, short what, gpointer p) { struct rspamd_redis_pool_connection *conn = p; + g_assert (!conn->active); msg_debug_rpool ("scheduled removal of connection, refcount: %d", conn->ref.refcount); REF_RELEASE (conn); @@ -346,12 +347,10 @@ rspamd_redis_pool_connect (struct rspamd_redis_pool *pool, if (g_queue_get_length (elt->inactive) > 0) { conn_entry = g_queue_pop_head_link (elt->inactive); conn = conn_entry->data; + g_assert (!conn->active); if (conn->ctx->err == REDIS_OK) { - if (event_get_base (&conn->timeout)) { - event_del (&conn->timeout); - } - + event_del (&conn->timeout); conn->active = TRUE; g_queue_push_tail_link (elt->active, conn_entry); msg_debug_rpool ("reused existing connection to %s:%d", ip, port);