diff options
Diffstat (limited to 'src/rspamd_proxy.c')
-rw-r--r-- | src/rspamd_proxy.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c index 0c9687c7e..737fff608 100644 --- a/src/rspamd_proxy.c +++ b/src/rspamd_proxy.c @@ -2216,6 +2216,7 @@ void start_rspamd_proxy (struct rspamd_worker *worker) { struct rspamd_proxy_ctx *ctx = worker->ctx; + gboolean is_controller = FALSE; g_assert (rspamd_worker_check_context (worker->ctx, rspamd_rspamd_proxy_magic)); ctx->cfg = worker->srv->cfg; @@ -2235,9 +2236,6 @@ start_rspamd_proxy (struct rspamd_worker *worker) (rspamd_mempool_destruct_t)rspamd_http_context_free, ctx->http_ctx); - rspamd_map_watch (worker->srv->cfg, ctx->event_loop, ctx->resolver, - worker, 0); - if (ctx->has_self_scan) { /* Additional initialisation needed */ rspamd_worker_init_scanner (worker, ctx->event_loop, ctx->resolver, @@ -2273,6 +2271,7 @@ start_rspamd_proxy (struct rspamd_worker *worker) msg_info ("no controller or normal workers defined, execute " "controller periodics in this worker"); worker->flags |= RSPAMD_WORKER_CONTROLLER; + is_controller = TRUE; } } } @@ -2294,6 +2293,14 @@ start_rspamd_proxy (struct rspamd_worker *worker) ctx->milter_ctx.cfg = ctx->cfg; rspamd_milter_init_library (&ctx->milter_ctx); + if (is_controller) { + rspamd_worker_init_controller (worker, NULL); + } + else { + rspamd_map_watch (worker->srv->cfg, ctx->event_loop, ctx->resolver, + worker, 0); + } + rspamd_lua_run_postloads (ctx->cfg->lua_state, ctx->cfg, ctx->event_loop, worker); adjust_upstreams_limits (ctx); @@ -2305,6 +2312,10 @@ start_rspamd_proxy (struct rspamd_worker *worker) rspamd_stat_close (); } + if (is_controller) { + rspamd_controller_on_terminate (worker, NULL); + } + REF_RELEASE (ctx->cfg); rspamd_log_close (worker->srv->logger, TRUE); |