From: Vsevolod Stakhov Date: Tue, 19 May 2015 14:37:20 +0000 (+0100) Subject: Fix reloading of modules. X-Git-Tag: 0.9.2~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d671707efb0803b291f1095cfdaef8f5d7bbe457;p=rspamd.git Fix reloading of modules. --- diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c index 5194d5266..da444cba2 100644 --- a/src/libserver/cfg_utils.c +++ b/src/libserver/cfg_utils.c @@ -854,15 +854,17 @@ rspamd_init_filters (struct rspamd_config *cfg, bool reconfig) struct module_ctx *mod_ctx; /* Init all compiled modules */ - for (pmod = modules; *pmod != NULL; pmod ++) { - mod = *pmod; - mod_ctx = g_slice_alloc0 (sizeof (struct module_ctx)); - - if (mod->module_init_func (cfg, &mod_ctx) == 0) { - g_hash_table_insert (cfg->c_modules, - (gpointer) mod->name, - mod_ctx); - mod_ctx->mod = mod; + if (!reconfig) { + for (pmod = modules; *pmod != NULL; pmod ++) { + mod = *pmod; + mod_ctx = g_slice_alloc0 (sizeof (struct module_ctx)); + + if (mod->module_init_func (cfg, &mod_ctx) == 0) { + g_hash_table_insert (cfg->c_modules, + (gpointer) mod->name, + mod_ctx); + mod_ctx->mod = mod; + } } }