summaryrefslogtreecommitdiffstats
path: root/src/rspamd.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-15 16:13:27 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-15 16:13:27 +0100
commitd4f429d3e398f43361ba00d6d36f022e6e9ab01a (patch)
treed638f5c6ea86f998a98793d9e92a97bf1d27ec8b /src/rspamd.c
parent7b53ccc5d7271a7f3af4a60dc3e00c63cb6385cf (diff)
downloadrspamd-d4f429d3e398f43361ba00d6d36f022e6e9ab01a.tar.gz
rspamd-d4f429d3e398f43361ba00d6d36f022e6e9ab01a.zip
Fix termination.
Diffstat (limited to 'src/rspamd.c')
-rw-r--r--src/rspamd.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/rspamd.c b/src/rspamd.c
index fb6e1fcbf..21563bf18 100644
--- a/src/rspamd.c
+++ b/src/rspamd.c
@@ -75,7 +75,7 @@
#define SOFT_FORK_TIME 2
/* 10 seconds after getting termination signal to terminate all workers with SIGKILL */
-#define TERMINATION_ATTEMPTS 40
+#define TERMINATION_ATTEMPTS 50
static gboolean load_rspamd_config (struct rspamd_main *rspamd_main,
struct rspamd_config *cfg,
@@ -554,7 +554,6 @@ wait_for_workers (gpointer key, gpointer value, gpointer unused)
}
else {
msg_info_main ("waiting for workers to sync");
- return FALSE;
}
}
@@ -760,7 +759,9 @@ rspamd_final_term_handler (gint signo, short what, gpointer arg)
{
struct rspamd_main *rspamd_main = arg;
- term_attempts --;
+ if (term_attempts) {
+ term_attempts--;
+ }
g_hash_table_foreach_remove (rspamd_main->workers, wait_for_workers, NULL);
@@ -1041,6 +1042,13 @@ main (gint argc, gchar **argv, gchar **env)
}
event_base_loop (ev_base, 0);
+ /* We need to block signals unless children are waited for */
+ sigaddset (&signals.sa_mask, SIGTERM);
+ sigaddset (&signals.sa_mask, SIGINT);
+ sigaddset (&signals.sa_mask, SIGHUP);
+ sigaddset (&signals.sa_mask, SIGUSR1);
+ sigaddset (&signals.sa_mask, SIGUSR2);
+ sigprocmask (SIG_BLOCK, &signals.sa_mask, NULL);
if (control_fd != -1) {
event_del (&control_ev);