aboutsummaryrefslogtreecommitdiffstats
path: root/src/rspamd_proxy.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-11 14:41:57 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-11 15:30:30 +0000
commit63800059e8dacc1ba69b623719c21355a77301c5 (patch)
tree4fa217e014f7932c547e1815e217c332f4611309 /src/rspamd_proxy.c
parent82ca7ec2ac7f02f67304e1ed7b6859cabdfeae22 (diff)
downloadrspamd-63800059e8dacc1ba69b623719c21355a77301c5.tar.gz
rspamd-63800059e8dacc1ba69b623719c21355a77301c5.zip
[Rework] Further isolation of the controller's functions
Diffstat (limited to 'src/rspamd_proxy.c')
-rw-r--r--src/rspamd_proxy.c17
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);