diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-11-30 17:48:08 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2011-11-30 17:48:08 +0300 |
commit | 632e13627f8ad4ebf632a8b616c62dc6622d375e (patch) | |
tree | 91654d26d1e76d8c677b0dec7be8059c0c1f86ef /src/fuzzy_storage.c | |
parent | 2975827e40a8e7c6e820c42921fb8792cf637450 (diff) | |
download | rspamd-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/fuzzy_storage.c')
-rw-r--r-- | src/fuzzy_storage.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index b9b05cb87..408d39960 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -102,9 +102,6 @@ sig_handler (gint signo, siginfo_t *info, void *unused) #endif { switch (signo) { - case SIGUSR1: - reopen_log (rspamd_main->logger); - break; case SIGINT: case SIGTERM: /* Ignore SIGINT and SIGTERM as they are handled by libevent handler */ @@ -251,7 +248,7 @@ sigterm_handler (gint fd, short what, void *arg) * Config reload is designed by sending sigusr 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 */ @@ -261,7 +258,8 @@ sigusr_handler (gint fd, short what, void *arg) ctx = worker->ctx; 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); close (worker->cf->listen_sock); msg_info ("worker's shutdown is pending in %d sec", SOFT_SHUTDOWN_TIME); @@ -271,6 +269,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; +} + static gboolean read_hashes_file (struct rspamd_worker *wrk) { @@ -790,8 +801,13 @@ start_fuzzy_storage (struct rspamd_worker *worker) sigprocmask (SIG_UNBLOCK, &signals.sa_mask, NULL); /* SIGUSR2 handler */ - signal_set (&worker->sig_ev, SIGUSR2, sigusr_handler, (void *)worker); - signal_add (&worker->sig_ev, NULL); + signal_set (&worker->sig_ev_usr2, SIGUSR2, sigusr2_handler, (void *) worker); + signal_add (&worker->sig_ev_usr2, NULL); + + /* SIGUSR1 handler */ + signal_set (&worker->sig_ev_usr1, SIGUSR1, sigusr1_handler, (void *) worker); + signal_add (&worker->sig_ev_usr1, NULL); + signal_set (&sev, SIGTERM, sigterm_handler, (void *)worker); signal_add (&sev, NULL); |