aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/cfg_utils.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-14 19:16:36 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-14 19:16:36 +0100
commita7a0800daba34acc86308d4ba75b8fd8c5fce57c (patch)
tree542b4f8e8666d36604d0cedf1c8034eadc1c871e /src/libserver/cfg_utils.c
parent092129b5216cb55de385ee6138a29c537142596c (diff)
downloadrspamd-a7a0800daba34acc86308d4ba75b8fd8c5fce57c.tar.gz
rspamd-a7a0800daba34acc86308d4ba75b8fd8c5fce57c.zip
[Project] Lua_config: Add post init scripts
Diffstat (limited to 'src/libserver/cfg_utils.c')
-rw-r--r--src/libserver/cfg_utils.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 0f38cc389..3761d0861 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -245,18 +245,21 @@ rspamd_config_new (enum rspamd_config_init_flags flags)
void
rspamd_config_free (struct rspamd_config *cfg)
{
- struct rspamd_config_post_load_script *sc, *sctmp;
+ struct rspamd_config_cfg_lua_script *sc, *sctmp;
struct rspamd_config_settings_elt *set, *stmp;
struct rspamd_worker_log_pipe *lp, *ltmp;
- DL_FOREACH_SAFE (cfg->finish_callbacks, sc, sctmp) {
+ /* Scripts part */
+ DL_FOREACH_SAFE (cfg->on_term_scripts, sc, sctmp) {
luaL_unref (cfg->lua_state, LUA_REGISTRYINDEX, sc->cbref);
- g_free (sc);
}
- DL_FOREACH_SAFE (cfg->on_load, sc, sctmp) {
+ DL_FOREACH_SAFE (cfg->on_load_scripts, sc, sctmp) {
+ luaL_unref (cfg->lua_state, LUA_REGISTRYINDEX, sc->cbref);
+ }
+
+ DL_FOREACH_SAFE (cfg->post_init_scripts, sc, sctmp) {
luaL_unref (cfg->lua_state, LUA_REGISTRYINDEX, sc->cbref);
- g_free (sc);
}
DL_FOREACH_SAFE (cfg->setting_ids, set, stmp) {
@@ -870,6 +873,10 @@ rspamd_config_post_load (struct rspamd_config *cfg,
rspamd_map_preload (cfg);
}
+ if (opts & RSPAMD_CONFIG_INIT_POST_LOAD_LUA) {
+ rspamd_lua_run_config_post_init (cfg->lua_state, cfg);
+ }
+
return ret;
}