diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-14 12:39:50 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-01-14 12:39:50 +0000 |
commit | 48bb5551ff24e89228d56bb08ab45281dc3d6f78 (patch) | |
tree | f45d21231e3713c44bcc0f4e64020758ccfa59bb | |
parent | c29a129205f0d318668f769c8ae522f11c4cabd7 (diff) | |
download | rspamd-48bb5551ff24e89228d56bb08ab45281dc3d6f78.tar.gz rspamd-48bb5551ff24e89228d56bb08ab45281dc3d6f78.zip |
[Minor] Add more sanity checks to redis pool
-rw-r--r-- | src/libserver/redis_pool.c | 7 |
1 files changed, 3 insertions, 4 deletions
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); |