#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,
}
else {
msg_info_main ("waiting for workers to sync");
- return FALSE;
}
}
{
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);
}
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);