aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lua/lua_redis.c12
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));