diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-13 15:30:31 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2015-05-13 15:30:31 +0100 |
commit | 7cb545ef98d323c142bff391a8a9dfe7b9148e97 (patch) | |
tree | 9568bcb8cee0c1a7069a5e1e97431ff4c22c65a8 /src | |
parent | cadc9b6bb63fbd225a0ec6a45b301a8598d17757 (diff) | |
download | rspamd-7cb545ef98d323c142bff391a8a9dfe7b9148e97.tar.gz rspamd-7cb545ef98d323c142bff391a8a9dfe7b9148e97.zip |
Break deadlock in redis timeout logic.
Diffstat (limited to 'src')
-rw-r--r-- | src/lua/lua_redis.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c index 8111ccf89..4af8d20b8 100644 --- a/src/lua/lua_redis.c +++ b/src/lua/lua_redis.c @@ -70,12 +70,13 @@ struct lua_redis_userdata { lua_State *L; struct rspamd_task *task; struct event timeout; - gint cbref; gchar *server; gchar *reqline; - guint16 port; gchar **args; + gint cbref; guint nargs; + guint16 port; + guint16 terminated; }; static void @@ -98,6 +99,7 @@ lua_redis_fin (void *arg) struct lua_redis_userdata *ud = arg; if (ud->ctx) { + ud->terminated = 1; redisAsyncFree (ud->ctx); lua_redis_free_args (ud); event_del (&ud->timeout); @@ -206,6 +208,11 @@ lua_redis_callback (redisAsyncContext *c, gpointer r, gpointer priv) redisReply *reply = r; struct lua_redis_userdata *ud = priv; + if (ud->terminated) { + /* We are already at the termination stage, just go out */ + return; + } + if (c->err == 0) { if (r != NULL) { if (reply->type != REDIS_REPLY_ERROR) { @@ -393,6 +400,7 @@ lua_redis_make_request (lua_State *L) } if (ret) { + ud->terminated = 0; ud->ctx = redisAsyncConnect (rspamd_inet_address_to_string (addr->addr), rspamd_inet_address_get_port (addr->addr)); |