aboutsummaryrefslogtreecommitdiffstats
path: root/src/worker.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2011-11-30 17:48:08 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2011-11-30 17:48:08 +0300
commit632e13627f8ad4ebf632a8b616c62dc6622d375e (patch)
tree91654d26d1e76d8c677b0dec7be8059c0c1f86ef /src/worker.c
parent2975827e40a8e7c6e820c42921fb8792cf637450 (diff)
downloadrspamd-632e13627f8ad4ebf632a8b616c62dc6622d375e.tar.gz
rspamd-632e13627f8ad4ebf632a8b616c62dc6622d375e.zip
Check for SIGUSR1 by libevent to avoid signals collisions.
Remove greylist_storage as it was never used and is actually replaced with basic kvstorage.
Diffstat (limited to 'src/worker.c')
-rw-r--r--src/worker.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/worker.c b/src/worker.c
index b3e56c13f..d1aeea859 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -109,9 +109,6 @@ sig_handler (gint signo, siginfo_t * info, void *unused)
struct timeval tv;
switch (signo) {
- case SIGUSR1:
- reopen_log (rspamd_main->logger);
- break;
case SIGINT:
case SIGTERM:
if (!wanna_die) {
@@ -129,10 +126,10 @@ sig_handler (gint signo, siginfo_t * info, void *unused)
}
/*
- * Config reload is designed by sending sigusr to active workers and pending shutdown of them
+ * Config reload is designed by sending sigusr2 to active workers and pending shutdown of them
*/
static void
-sigusr_handler (gint fd, short what, void *arg)
+sigusr2_handler (gint fd, short what, void *arg)
{
struct rspamd_worker *worker = (struct rspamd_worker *) arg;
/* Do not accept new connections, preparing to end worker's process */
@@ -141,7 +138,8 @@ sigusr_handler (gint fd, short what, void *arg)
if (!wanna_die) {
tv.tv_sec = SOFT_SHUTDOWN_TIME;
tv.tv_usec = 0;
- event_del (&worker->sig_ev);
+ event_del (&worker->sig_ev_usr1);
+ event_del (&worker->sig_ev_usr2);
event_del (&worker->bind_ev);
msg_info ("worker's shutdown is pending in %d sec", SOFT_SHUTDOWN_TIME);
event_loopexit (&tv);
@@ -149,6 +147,19 @@ sigusr_handler (gint fd, short what, void *arg)
return;
}
+/*
+ * Reopen log is designed by sending sigusr1 to active workers and pending shutdown of them
+ */
+static void
+sigusr1_handler (gint fd, short what, void *arg)
+{
+ struct rspamd_worker *worker = (struct rspamd_worker *) arg;
+
+ reopen_log (worker->srv->logger);
+
+ return;
+}
+
#ifndef BUILD_STATIC
static void
fin_custom_filters (struct worker_task *task)
@@ -651,9 +662,14 @@ start_worker (struct rspamd_worker *worker)
sigprocmask (SIG_UNBLOCK, &signals.sa_mask, NULL);
/* SIGUSR2 handler */
- signal_set (&worker->sig_ev, SIGUSR2, sigusr_handler, (void *) worker);
- event_base_set (ctx->ev_base, &worker->sig_ev);
- signal_add (&worker->sig_ev, NULL);
+ signal_set (&worker->sig_ev_usr2, SIGUSR2, sigusr2_handler, (void *) worker);
+ event_base_set (ctx->ev_base, &worker->sig_ev_usr2);
+ signal_add (&worker->sig_ev_usr2, NULL);
+
+ /* SIGUSR1 handler */
+ signal_set (&worker->sig_ev_usr1, SIGUSR1, sigusr1_handler, (void *) worker);
+ event_base_set (ctx->ev_base, &worker->sig_ev_usr1);
+ signal_add (&worker->sig_ev_usr1, NULL);
/* Accept event */
event_set (&worker->bind_ev, worker->cf->listen_sock, EV_READ | EV_PERSIST,