From d671707efb0803b291f1095cfdaef8f5d7bbe457 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 19 May 2015 15:37:20 +0100 Subject: [PATCH] Fix reloading of modules. --- src/libserver/cfg_utils.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) 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; + } } } -- 2.39.5