diff options
-rw-r--r-- | src/libserver/worker_util.c | 10 | ||||
-rw-r--r-- | src/rspamd.h | 1 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c index 2a0a76d04..98da2ce9a 100644 --- a/src/libserver/worker_util.c +++ b/src/libserver/worker_util.c @@ -87,8 +87,6 @@ rspamd_get_worker_by_type (struct rspamd_config *cfg, GQuark type) return NULL; } -sig_atomic_t wanna_die = 0; - static void rspamd_worker_terminate_handlers (struct rspamd_worker *w) { @@ -109,10 +107,10 @@ rspamd_worker_usr2_handler (struct rspamd_worker_signal_handler *sigh, void *arg /* Do not accept new connections, preparing to end worker's process */ struct timeval tv; - if (!wanna_die) { + if (!sigh->worker->wanna_die) { tv.tv_sec = SOFT_SHUTDOWN_TIME; tv.tv_usec = 0; - wanna_die = 1; + sigh->worker->wanna_die = TRUE; rspamd_worker_terminate_handlers (sigh->worker); rspamd_default_log_function (G_LOG_LEVEL_INFO, sigh->worker->srv->server_pool->tag.tagname, @@ -139,7 +137,7 @@ rspamd_worker_term_handler (struct rspamd_worker_signal_handler *sigh, void *arg { struct timeval tv; - if (!wanna_die) { + if (!sigh->worker->wanna_die) { rspamd_default_log_function (G_LOG_LEVEL_INFO, sigh->worker->srv->server_pool->tag.tagname, sigh->worker->srv->server_pool->tag.uid, @@ -147,7 +145,7 @@ rspamd_worker_term_handler (struct rspamd_worker_signal_handler *sigh, void *arg "terminating after receiving signal %s", g_strsignal (sigh->signo)); rspamd_worker_terminate_handlers (sigh->worker); - wanna_die = 1; + sigh->worker->wanna_die = 1; tv.tv_sec = 0; tv.tv_usec = 0; diff --git a/src/rspamd.h b/src/rspamd.h index 999061a99..e99e4c18d 100644 --- a/src/rspamd.h +++ b/src/rspamd.h @@ -49,6 +49,7 @@ struct rspamd_worker { pid_t pid; /**< pid of worker */ guint index; /**< index number */ guint nconns; /**< current connections count */ + gboolean wanna_die; /**< worker is terminating */ gdouble start_time; /**< start time */ struct rspamd_main *srv; /**< pointer to server structure */ GQuark type; /**< process type */ |