From daec65bd2a68c04b9144dff91c863cfd2cb30b93 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 10 Aug 2018 11:02:08 +0100 Subject: [PATCH] [Fix] Do not try to process skipped messages --- src/libserver/symbols_cache.c | 12 ++++++++++++ src/lua/lua_task.c | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c index 6076d1743..69a1f7158 100644 --- a/src/libserver/symbols_cache.c +++ b/src/libserver/symbols_cache.c @@ -1709,6 +1709,10 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, for (i = 0; i < (gint)cache->prefilters->len; i ++) { item = g_ptr_array_index (cache->prefilters, i); + if (RSPAMD_TASK_IS_SKIPPED (task)) { + return TRUE; + } + if (!isset (checkpoint->processed_bits, item->id * 2) && !isset (checkpoint->processed_bits, item->id * 2 + 1)) { /* Check priorities */ @@ -1762,6 +1766,10 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, * we just save it for another pass */ for (i = 0; i < (gint)checkpoint->version; i ++) { + if (RSPAMD_TASK_IS_SKIPPED (task)) { + return TRUE; + } + item = g_ptr_array_index (checkpoint->order->d, i); if (item->type & SYMBOL_TYPE_CLASSIFIER) { @@ -1882,6 +1890,10 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, saved_priority = G_MININT; for (i = 0; i < (gint)cache->postfilters->len; i ++) { + if (RSPAMD_TASK_IS_SKIPPED (task)) { + return TRUE; + } + item = g_ptr_array_index (cache->postfilters, i); if (!isset (checkpoint->processed_bits, item->id * 2) && diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index e4defa667..e60fe6592 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -1572,6 +1572,11 @@ lua_task_set_pre_result (lua_State * L) if (task != NULL) { + if (RSPAMD_TASK_IS_SKIPPED (task)) { + /* Do not set pre-result for a skipped task */ + return 0; + } + if (lua_type (L, 2) == LUA_TNUMBER) { action = lua_tointeger (L, 2); } -- 2.39.5