diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-08-14 12:51:54 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-08-14 12:51:54 +0100 |
commit | 1af89c35663dd364c8d46523f0d71adc64f8bde4 (patch) | |
tree | 1a814dea5f5ce6045bd53f2e802dd3eb87123ca0 /src/libstat | |
parent | 0478b4ee28138a886f9b457bdba7f2897e151093 (diff) | |
download | rspamd-1af89c35663dd364c8d46523f0d71adc64f8bde4.tar.gz rspamd-1af89c35663dd364c8d46523f0d71adc64f8bde4.zip |
[Fix] Add fail-safety for destroying sessions
Diffstat (limited to 'src/libstat')
-rw-r--r-- | src/libstat/backends/redis_backend.c | 7 | ||||
-rw-r--r-- | src/libstat/learn_cache/redis_cache.c | 8 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c index 69c14e167..5510cff05 100644 --- a/src/libstat/backends/redis_backend.c +++ b/src/libstat/backends/redis_backend.c @@ -1572,6 +1572,9 @@ rspamd_redis_process_tokens (struct rspamd_task *task, gint ret; const gchar *learned_key = "learns"; + if (rspamd_session_is_destroying (task->s)) { + return FALSE; + } if (tokens == NULL || tokens->len == 0 || rt->redis == NULL) { return FALSE; @@ -1664,6 +1667,10 @@ rspamd_redis_learn_tokens (struct rspamd_task *task, GPtrArray *tokens, goffset off; const gchar *learned_key = "learns"; + if (rspamd_session_is_destroying (task->s)) { + return FALSE; + } + up = rspamd_upstream_get (rt->ctx->write_servers, RSPAMD_UPSTREAM_MASTER_SLAVE, NULL, diff --git a/src/libstat/learn_cache/redis_cache.c b/src/libstat/learn_cache/redis_cache.c index d43ec3665..e17f20d27 100644 --- a/src/libstat/learn_cache/redis_cache.c +++ b/src/libstat/learn_cache/redis_cache.c @@ -438,6 +438,10 @@ rspamd_stat_cache_redis_check (struct rspamd_task *task, struct timeval tv; gchar *h; + if (rspamd_session_is_destroying (task->s)) { + return RSPAMD_LEARN_INGORE; + } + h = rspamd_mempool_get_variable (task->task_pool, "words_hash"); if (h == NULL) { @@ -469,6 +473,10 @@ rspamd_stat_cache_redis_learn (struct rspamd_task *task, gchar *h; gint flag; + if (rspamd_session_is_destroying (task->s)) { + return RSPAMD_LEARN_INGORE; + } + h = rspamd_mempool_get_variable (task->task_pool, "words_hash"); g_assert (h != NULL); |