From d6ff0ee6444a52bba805f0746ed795d68b56fb8a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 10 Jun 2011 18:34:05 +0400 Subject: [PATCH] Improve performance of trie search. --- src/plugins/lua/multimap.lua | 2 +- src/plugins/lua/trie.lua | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/lua/multimap.lua b/src/plugins/lua/multimap.lua index 8a0596115..548cc2ea6 100644 --- a/src/plugins/lua/multimap.lua +++ b/src/plugins/lua/multimap.lua @@ -50,7 +50,7 @@ function check_multimap(task) end else local ip = task:get_from_ip_num() - if ip and rule['ips']:get_key(ip) then + if ip and rule['ips'] and rule['ips']:get_key(ip) then task:insert_result(rule['symbol'], 1) end end diff --git a/src/plugins/lua/trie.lua b/src/plugins/lua/trie.lua index 152935d8b..65524745c 100644 --- a/src/plugins/lua/trie.lua +++ b/src/plugins/lua/trie.lua @@ -65,6 +65,7 @@ function check_trie(task) for _,trie in ipairs(tries) do if trie['trie']:search_task(task) then task:insert_result(trie['symbol'], 1) + return end -- Search inside urls urls = task:get_urls() @@ -72,6 +73,7 @@ function check_trie(task) for _,url in ipairs(urls) do if trie['trie']:search_text(url:get_text()) then task:insert_result(trie['symbol'], 1) + return end end end -- 2.39.5