commit 13d9071: [Minor] Sigh - another try to avoid races

Vsevolod Stakhov vsevolod at highsecure.ru
Mon Jan 13 10:07:06 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-01-13 10:06:31 +0000
URL: https://github.com/rspamd/rspamd/commit/13d9071f962ec51088ea2eefbe312c6c7682bf23 (HEAD -> master)

[Minor] Sigh - another try to avoid races

---
 src/libserver/redis_pool.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/libserver/redis_pool.c b/src/libserver/redis_pool.c
index 732d3b5bf..3cae96deb 100644
--- a/src/libserver/redis_pool.c
+++ b/src/libserver/redis_pool.c
@@ -205,15 +205,15 @@ rspamd_redis_conn_timeout (EV_P_ ev_timer *w, int revents)
 	if (conn->state == RSPAMD_REDIS_POOL_CONN_INACTIVE) {
 		msg_debug_rpool ("scheduled soft removal of connection %p, refcount: %d",
 				conn->ctx, conn->ref.refcount);
-		redisAsyncCommand (conn->ctx, rspamd_redis_on_quit, conn, "QUIT");
-		conn->state = RSPAMD_REDIS_POOL_CONN_FINALISING;
-		ev_timer_again (EV_A_ w);
-
 		/* Prevent reusing */
 		if (conn->entry) {
 			g_queue_unlink (conn->elt->inactive, conn->entry);
 			conn->entry = NULL;
 		}
+
+		conn->state = RSPAMD_REDIS_POOL_CONN_FINALISING;
+		ev_timer_again (EV_A_ w);
+		redisAsyncCommand (conn->ctx, rspamd_redis_on_quit, conn, "QUIT");
 	}
 	else {
 		/* Finalising by timeout */


More information about the Commits mailing list