diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-03-18 16:07:23 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-03-18 16:07:23 +0300 |
commit | 9309c11521c7a93357f1160edf9693f8b50f4441 (patch) | |
tree | 4a9c77f7d963a013b94889a35d6844174f310a00 | |
parent | 3127a72ffe055e85298fe16f1307f7e84105a2eb (diff) | |
download | rspamd-9309c11521c7a93357f1160edf9693f8b50f4441.tar.gz rspamd-9309c11521c7a93357f1160edf9693f8b50f4441.zip |
Fix misprint in multimap module.
Fix how we detect weight of symbol in a cache.
-rw-r--r-- | src/plugins/lua/multimap.lua | 4 | ||||
-rw-r--r-- | src/symbols_cache.c | 16 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 699d2cc75..023801e45 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -103,11 +103,11 @@ function check_multimap(task) local _,_,ext = string.find(r['addr'], rule['pattern']) if ext then if rule['cdb'] then - if rule['hash']:lookup(hv) then + if rule['hash']:lookup(ext) then task:insert_result(rule['symbol'], 1) end else - if rule['hash']:get_key(hv) then + if rule['hash']:get_key(ext) then task:insert_result(rule['symbol'], 1) end end diff --git a/src/symbols_cache.c b/src/symbols_cache.c index 492387bac..ca76ffe86 100644 --- a/src/symbols_cache.c +++ b/src/symbols_cache.c @@ -263,14 +263,6 @@ register_symbol_common (struct symbols_cache **cache, const gchar *name, double *cache = pcache; pcache->static_pool = memory_pool_new (memory_pool_get_size ()); } - - - if (weight > 0) { - target = &(*cache)->static_items; - } - else { - target = &(*cache)->negative_items; - } item = memory_pool_alloc0 (pcache->static_pool, sizeof (struct cache_item)); item->s = memory_pool_alloc0 (pcache->static_pool, sizeof (struct saved_cache_item)); @@ -296,6 +288,14 @@ register_symbol_common (struct symbols_cache **cache, const gchar *name, double else { item->s->weight = weight; } + + if (item->s->weight > 0) { + target = &(*cache)->static_items; + } + else { + target = &(*cache)->negative_items; + } + pcache->used_items++; msg_debug ("used items: %d, added symbol: %s", (*cache)->used_items, name); set_counter (item->s->symbol, 0); |