aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-22 16:28:52 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-22 16:28:52 +0100
commit04a539f1333f7dfc3b1d6799b16956b576cad3cb (patch)
treeb9215f2fe8c1fc5874be4922980764538d08d66f /src/lua
parentca1b4f4d477fbc52df8ac5e399949611e8351a8d (diff)
downloadrspamd-04a539f1333f7dfc3b1d6799b16956b576cad3cb.tar.gz
rspamd-04a539f1333f7dfc3b1d6799b16956b576cad3cb.zip
[Feature] Add a concept of ignored symbols to avoid race conditions
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/lua_task.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index ca55609a7..db5bd090a 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -3309,11 +3309,13 @@ lua_task_get_symbols (lua_State *L)
while (g_hash_table_iter_next (&it, &k, &v)) {
s = v;
- lua_pushstring (L, k);
- lua_rawseti (L, -3, i);
- lua_pushnumber (L, s->score);
- lua_rawseti (L, -2, i);
- i ++;
+ if (!(s->flags & RSPAMD_SYMBOL_RESULT_IGNORED)) {
+ lua_pushstring (L, k);
+ lua_rawseti (L, -3, i);
+ lua_pushnumber (L, s->score);
+ lua_rawseti (L, -2, i);
+ i++;
+ }
}
}
else {
@@ -3384,14 +3386,17 @@ lua_task_get_symbols_numeric (lua_State *L)
g_hash_table_iter_init (&it, mres->symbols);
while (g_hash_table_iter_next (&it, &k, &v)) {
- id = rspamd_symbols_cache_find_symbol (task->cfg->cache,
- k);
s = v;
- lua_pushnumber (L, id);
- lua_rawseti (L, -3, i);
- lua_pushnumber (L, s->score);
- lua_rawseti (L, -2, i);
- i ++;
+
+ if (!(s->flags & RSPAMD_SYMBOL_RESULT_IGNORED)) {
+ id = rspamd_symbols_cache_find_symbol (task->cfg->cache,
+ k);
+ lua_pushnumber (L, id);
+ lua_rawseti (L, -3, i);
+ lua_pushnumber (L, s->score);
+ lua_rawseti (L, -2, i);
+ i++;
+ }
}
}
else {