aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-11-23 13:04:11 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-11-23 13:04:11 +0000
commitd8a89b0b159077c83ba872903039afacac6fb903 (patch)
tree9065484269d9302c1d8c283bcf6b43370983308c /src/libserver
parent6acbf5e15876c3fda98a79d38f7cfe4bea0663fe (diff)
downloadrspamd-d8a89b0b159077c83ba872903039afacac6fb903.tar.gz
rspamd-d8a89b0b159077c83ba872903039afacac6fb903.zip
[Minor] Adjust multipattern sizes
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/url.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/libserver/url.c b/src/libserver/url.c
index acddc464f..a4f82cd9e 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -439,10 +439,21 @@ rspamd_url_init (const gchar *tld_file)
if (url_scanner == NULL) {
url_scanner = g_malloc (sizeof (struct url_match_scanner));
- url_scanner->matchers = g_array_sized_new (FALSE, TRUE,
- sizeof (struct url_matcher), 512);
- url_scanner->search_trie = rspamd_multipattern_create_sized (512,
+
+ if (tld_file) {
+ /* Reserve larger multipattern */
+ url_scanner->matchers = g_array_sized_new (FALSE, TRUE,
+ sizeof (struct url_matcher), 13000);
+ url_scanner->search_trie = rspamd_multipattern_create_sized (13000,
RSPAMD_MULTIPATTERN_TLD | RSPAMD_MULTIPATTERN_ICASE);
+ }
+ else {
+ url_scanner->matchers = g_array_sized_new (FALSE, TRUE,
+ sizeof (struct url_matcher), 128);
+ url_scanner->search_trie = rspamd_multipattern_create_sized (128,
+ RSPAMD_MULTIPATTERN_TLD | RSPAMD_MULTIPATTERN_ICASE);
+ }
+
rspamd_url_add_static_matchers (url_scanner);
if (tld_file != NULL) {