diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-11-01 17:22:45 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-11-01 17:22:45 +0000 |
commit | 5a7510046a6fa1bda081a77f1020ce6402f4be8e (patch) | |
tree | 2c9b4bca5e729bbfc4732a209b9edc44c3a719b7 /src/libserver/worker_util.c | |
parent | 0ee5ff3f3942a0396b6dba336dee736a2f14dc4c (diff) | |
download | rspamd-5a7510046a6fa1bda081a77f1020ce6402f4be8e.tar.gz rspamd-5a7510046a6fa1bda081a77f1020ce6402f4be8e.zip |
Fix signals initializing.
Diffstat (limited to 'src/libserver/worker_util.c')
-rw-r--r-- | src/libserver/worker_util.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c index 99829edb0..631758829 100644 --- a/src/libserver/worker_util.c +++ b/src/libserver/worker_util.c @@ -146,6 +146,7 @@ rspamd_worker_set_signal_handler (int signo, struct rspamd_worker *worker, static void rspamd_worker_init_signals (struct rspamd_worker *worker, struct event_base *base) { + struct sigaction signals; /* We ignore these signals in the worker */ rspamd_worker_ignore_signal (SIGPIPE); rspamd_worker_ignore_signal (SIGALRM); @@ -162,8 +163,21 @@ rspamd_worker_init_signals (struct rspamd_worker *worker, struct event_base *bas /* Special purpose signals */ rspamd_worker_set_signal_handler (SIGUSR1, worker, base, rspamd_worker_usr1_handler); - rspamd_worker_set_signal_handler (SIGUSR1, worker, base, + rspamd_worker_set_signal_handler (SIGUSR2, worker, base, rspamd_worker_usr2_handler); + + /* Unblock all signals processed */ + sigemptyset (&signals.sa_mask); + sigaddset (&signals.sa_mask, SIGTERM); + sigaddset (&signals.sa_mask, SIGINT); + sigaddset (&signals.sa_mask, SIGHUP); + sigaddset (&signals.sa_mask, SIGCHLD); + sigaddset (&signals.sa_mask, SIGUSR1); + sigaddset (&signals.sa_mask, SIGUSR2); + sigaddset (&signals.sa_mask, SIGALRM); + sigaddset (&signals.sa_mask, SIGPIPE); + + sigprocmask (SIG_UNBLOCK, &signals.sa_mask, NULL); } struct event_base * @@ -183,7 +197,7 @@ rspamd_prepare_worker (struct rspamd_worker *worker, const char *name, gperf_profiler_init (worker->srv->cfg, name); worker->srv->pid = getpid (); - worker->signal_events = g_hash_table_new_full (g_int_hash, g_int_equal, + worker->signal_events = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free); ev_base = event_init (); |