aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_redis.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-14 12:51:54 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-14 12:51:54 +0100
commit1af89c35663dd364c8d46523f0d71adc64f8bde4 (patch)
tree1a814dea5f5ce6045bd53f2e802dd3eb87123ca0 /src/lua/lua_redis.c
parent0478b4ee28138a886f9b457bdba7f2897e151093 (diff)
downloadrspamd-1af89c35663dd364c8d46523f0d71adc64f8bde4.tar.gz
rspamd-1af89c35663dd364c8d46523f0d71adc64f8bde4.zip
[Fix] Add fail-safety for destroying sessions
Diffstat (limited to 'src/lua/lua_redis.c')
-rw-r--r--src/lua/lua_redis.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c
index cf416a12a..82ef0c53b 100644
--- a/src/lua/lua_redis.c
+++ b/src/lua/lua_redis.c
@@ -675,6 +675,10 @@ rspamd_lua_redis_prepare_connection (lua_State *L, gint *pcbref)
lua_pop (L, 1); /* table */
+ if (session && rspamd_session_is_destroying (session)) {
+ ret = FALSE;
+ }
+
if (ret && addr != NULL) {
ctx = g_malloc0 (sizeof (struct lua_redis_ctx));
@@ -1200,6 +1204,13 @@ lua_redis_add_cmd (lua_State *L)
LL_PREPEND (sp_ud->c->specific, sp_ud);
+ if (ud->s && rspamd_session_is_destroying (ud->s)) {
+ lua_pushboolean (L, 0);
+ lua_pushstring (L, "session is terminating");
+
+ return 2;
+ }
+
ret = redisAsyncCommandArgv (sp_ud->c->ctx,
lua_redis_callback,
sp_ud,