From: Vsevolod Stakhov Date: Wed, 22 Dec 2010 14:25:51 +0000 (+0300) Subject: Init cache before loading config. X-Git-Tag: 0.3.7~95 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fd34e65f68a612e097611d261616457ce2e91966;p=thirdparty%2Frspamd.git Init cache before loading config. --- diff --git a/src/cfg_xml.c b/src/cfg_xml.c index 70f3ebda89..389298e4a8 100644 --- a/src/cfg_xml.c +++ b/src/cfg_xml.c @@ -1023,7 +1023,6 @@ handle_composite (struct config_file *cfg, struct rspamd_xml_userdata *ctx, GHas return FALSE; } g_hash_table_insert (cfg->composite_symbols, val, expr); - register_virtual_symbol (&cfg->cache, val, 1); return TRUE; } diff --git a/src/main.c b/src/main.c index 72a7b6eac3..14a4988eec 100644 --- a/src/main.c +++ b/src/main.c @@ -829,6 +829,12 @@ main (gint argc, gchar **argv, gchar **env) register_classifier_opt ("winnow", "min_tokens"); register_classifier_opt ("winnow", "learn_threshold"); + /* Pre-init of cache */ + rspamd->cfg->cache = g_new0 (struct symbols_cache, 1); + rspamd->cfg->cache->static_pool = memory_pool_new (memory_pool_get_size ()); + rspamd->cfg->cache->cfg = rspamd->cfg; + + /* Load config */ if (! load_rspamd_config (rspamd->cfg, TRUE)) { exit (EXIT_FAILURE); } @@ -837,10 +843,6 @@ main (gint argc, gchar **argv, gchar **env) if (is_debug) { rspamd->cfg->log_level = G_LOG_LEVEL_DEBUG; } - /* Pre-init of cache */ - rspamd->cfg->cache = g_new0 (struct symbols_cache, 1); - rspamd->cfg->cache->static_pool = memory_pool_new (memory_pool_get_size ()); - rspamd->cfg->cache->cfg = rspamd->cfg; if (rspamd->cfg->config_test || dump_vars || dump_cache) { /* Init events to test modules */