diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-04-22 15:33:47 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-04-22 15:33:47 +0100 |
commit | 6120d294026b01790b633ead0908ca4a8c7aeb65 (patch) | |
tree | 29654b837bd9226204c690d2c1317b4338b87778 | |
parent | 630ceb658d8a0ab0804280fb900553e58f3af3c0 (diff) | |
download | rspamd-6120d294026b01790b633ead0908ca4a8c7aeb65.tar.gz rspamd-6120d294026b01790b633ead0908ca4a8c7aeb65.zip |
Use unified signal handlers.
-rw-r--r-- | src/controller.c | 69 | ||||
-rw-r--r-- | src/fuzzy_storage.c | 44 | ||||
-rw-r--r-- | src/libmime/worker_util.c | 79 | ||||
-rw-r--r-- | src/lua_worker.c | 78 | ||||
-rw-r--r-- | src/main.h | 1 | ||||
-rw-r--r-- | src/smtp.c | 76 | ||||
-rw-r--r-- | src/smtp_proxy.c | 75 | ||||
-rw-r--r-- | src/webui.c | 76 | ||||
-rw-r--r-- | src/worker.c | 76 |
9 files changed, 90 insertions, 484 deletions
diff --git a/src/controller.c b/src/controller.c index 0c2a8b25f..4665e4718 100644 --- a/src/controller.c +++ b/src/controller.c @@ -133,65 +133,9 @@ static GList *custom_commands = NULL; static time_t start_time; static gchar greetingbuf[1024]; -static sig_atomic_t wanna_die = 0; static gboolean controller_write_socket (void *arg); -#ifndef HAVE_SA_SIGINFO -static void -sig_handler (gint signo) -#else -static void -sig_handler (gint signo, siginfo_t *info, void *unused) -#endif -{ - struct timeval tv; - switch (signo) { - case SIGINT: - case SIGTERM: - if (!wanna_die) { - wanna_die = 1; - tv.tv_sec = 0; - tv.tv_usec = 0; - event_loopexit (&tv); - -#ifdef WITH_GPERF_TOOLS - ProfilerStop (); -#endif - } - break; - } -} - -static void -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 */ - struct timeval tv; - tv.tv_sec = 2; - tv.tv_usec = 0; - event_del (&worker->sig_ev_usr1); - event_del (&worker->sig_ev_usr2); - worker_stop_accept (worker); - msg_info ("controller's shutdown is pending in %d sec", 2); - event_loopexit (&tv); - 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 void free_session (void *ud) { @@ -1931,20 +1875,9 @@ start_controller (struct rspamd_worker *worker) GError *err = NULL; struct timeval tv; - ctx->ev_base = prepare_worker (worker, "controller", sig_handler, accept_socket); + ctx->ev_base = prepare_worker (worker, "controller", accept_socket); g_mime_init (0); - /* SIGUSR2 handler */ - 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); - - start_time = time (NULL); /* Start statfile synchronization */ diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index 80f899216..297e64ece 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -86,7 +86,6 @@ static guint32 mods = 0; static struct timeval tmv; static struct event tev; static struct rspamd_stat *server_stat; -static sig_atomic_t wanna_die = 0; struct rspamd_fuzzy_storage_ctx { gboolean strict_hash; @@ -126,22 +125,7 @@ struct fuzzy_session { struct rspamd_fuzzy_storage_ctx *ctx; }; -#ifndef HAVE_SA_SIGINFO -static void -sig_handler (gint signo) -#else -static void -sig_handler (gint signo, siginfo_t *info, void *unused) -#endif -{ - switch (signo) { - case SIGINT: - case SIGTERM: - /* Ignore SIGINT and SIGTERM as they are handled by libevent handler */ - return; - break; - } -} +extern sig_atomic_t wanna_die; static gint compare_nodes (gconstpointer a, gconstpointer b, gpointer unused) @@ -393,19 +377,6 @@ sigusr2_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) { @@ -997,23 +968,20 @@ start_fuzzy (struct rspamd_worker *worker) GError *err = NULL; gint i; - ctx->ev_base = prepare_worker (worker, "controller", sig_handler, accept_fuzzy_socket); - + ctx->ev_base = prepare_worker (worker, "controller", accept_fuzzy_socket); server_stat = worker->srv->stat; - /* SIGUSR2 handler */ + /* Custom SIGUSR2 handler */ + event_del (&worker->sig_ev_usr2); 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); - signal_set (&sev, SIGTERM, sigterm_handler, (void *)worker); event_base_set (ctx->ev_base, &sev); signal_add (&sev, NULL); + /* We set wanna_die to 1 as we setup our own SIGTERM handler */ + wanna_die = 1; if (ctx->strict_hash) { static_hash = g_hash_table_new_full (rspamd_str_hash, rspamd_str_equal, diff --git a/src/libmime/worker_util.c b/src/libmime/worker_util.c index aa5719f2c..5507cdb7c 100644 --- a/src/libmime/worker_util.c +++ b/src/libmime/worker_util.c @@ -78,9 +78,72 @@ set_counter (const gchar *name, guint32 value) return cd->value; } +sig_atomic_t wanna_die = 0; + +#ifndef HAVE_SA_SIGINFO +static void +worker_sig_handler (gint signo) +#else +static void +worker_sig_handler (gint signo, siginfo_t * info, void *unused) +#endif +{ + struct timeval tv; + + switch (signo) { + case SIGINT: + case SIGTERM: + if (!wanna_die) { + wanna_die = 1; + tv.tv_sec = 0; + tv.tv_usec = 0; + event_loopexit (&tv); + +#ifdef WITH_GPERF_TOOLS + ProfilerStop (); +#endif + } + break; + } +} + +/* + * Config reload is designed by sending sigusr2 to active workers and pending shutdown of them + */ +static void +worker_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 */ + struct timeval tv; + + if (!wanna_die) { + tv.tv_sec = SOFT_SHUTDOWN_TIME; + tv.tv_usec = 0; + event_del (&worker->sig_ev_usr1); + event_del (&worker->sig_ev_usr2); + worker_stop_accept (worker); + msg_info ("worker's shutdown is pending in %d sec", SOFT_SHUTDOWN_TIME); + event_loopexit (&tv); + } + return; +} + +/* + * Reopen log is designed by sending sigusr1 to active workers and pending shutdown of them + */ +static void +worker_sigusr1_handler (gint fd, short what, void *arg) +{ + struct rspamd_worker *worker = (struct rspamd_worker *) arg; + + reopen_log (worker->srv->logger); + + return; +} + struct event_base * prepare_worker (struct rspamd_worker *worker, const char *name, - rspamd_sig_handler_t sig_handler, void (*accept_handler)(int, short, void *)) { struct event_base *ev_base; @@ -100,7 +163,7 @@ prepare_worker (struct rspamd_worker *worker, const char *name, ev_base = event_init (); - init_signals (&signals, sig_handler); + init_signals (&signals, worker_sig_handler); sigprocmask (SIG_UNBLOCK, &signals.sa_mask, NULL); /* Accept all sockets */ @@ -118,6 +181,18 @@ prepare_worker (struct rspamd_worker *worker, const char *name, cur = g_list_next (cur); } + /* SIGUSR2 handler */ + signal_set (&worker->sig_ev_usr2, SIGUSR2, worker_sigusr2_handler, + (void *) worker); + event_base_set (ev_base, &worker->sig_ev_usr2); + signal_add (&worker->sig_ev_usr2, NULL); + + /* SIGUSR1 handler */ + signal_set (&worker->sig_ev_usr1, SIGUSR1, worker_sigusr1_handler, + (void *) worker); + event_base_set (ev_base, &worker->sig_ev_usr1); + signal_add (&worker->sig_ev_usr1, NULL); + return ev_base; } diff --git a/src/lua_worker.c b/src/lua_worker.c index c6482bcfd..f66124129 100644 --- a/src/lua_worker.c +++ b/src/lua_worker.c @@ -99,8 +99,6 @@ static const struct luaL_reg lua_workerlib_m[] = { {NULL, NULL} }; -static sig_atomic_t wanna_die = 0; - /* Basic functions of LUA API for worker object */ static gint luaopen_lua_worker (lua_State * L) @@ -253,69 +251,6 @@ lua_worker_get_cfg (lua_State *L) } /* End of lua API */ -/* Signal handlers */ - -#ifndef HAVE_SA_SIGINFO -static void -sig_handler (gint signo) -#else -static void -sig_handler (gint signo, siginfo_t * info, void *unused) -#endif -{ - struct timeval tv; - - switch (signo) { - case SIGINT: - case SIGTERM: - if (!wanna_die) { - wanna_die = 1; - tv.tv_sec = 0; - tv.tv_usec = 0; - event_loopexit (&tv); - -#ifdef WITH_GPERF_TOOLS - ProfilerStop (); -#endif - } - break; - } -} - -/* - * Config reload is designed by sending sigusr2 to active workers and pending shutdown of them - */ -static void -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 */ - struct timeval tv; - - if (!wanna_die) { - tv.tv_sec = SOFT_SHUTDOWN_TIME; - tv.tv_usec = 0; - event_del (&worker->sig_ev_usr1); - event_del (&worker->sig_ev_usr2); - worker_stop_accept (worker); - msg_info ("worker's shutdown is pending in %d sec", SOFT_SHUTDOWN_TIME); - event_loopexit (&tv); - } - 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; -} /* * Accept new connection and construct task @@ -406,23 +341,12 @@ start_lua_worker (struct rspamd_worker *worker) monstartup ((u_long) & _start, (u_long) & etext); #endif - ctx->ev_base = prepare_worker (worker, "lua_worker", sig_handler, lua_accept_socket); + ctx->ev_base = prepare_worker (worker, "lua_worker", lua_accept_socket); L = worker->srv->cfg->lua_state; ctx->L = L; ctx->cfg = worker->srv->cfg; - - /* SIGUSR2 handler */ - 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); - ctx->resolver = dns_resolver_init (worker->srv->logger, ctx->ev_base, worker->srv->cfg); /* Open worker's lib */ diff --git a/src/main.h b/src/main.h index 17d693cae..57a7907e5 100644 --- a/src/main.h +++ b/src/main.h @@ -218,7 +218,6 @@ typedef void (*rspamd_sig_handler_t) (gint, siginfo_t *, void *); */ struct event_base * prepare_worker (struct rspamd_worker *worker, const char *name, - rspamd_sig_handler_t sig_handler, void (*accept_handler)(int, short, void *)); /** diff --git a/src/smtp.c b/src/smtp.c index 2d36c0549..166b4eba4 100644 --- a/src/smtp.c +++ b/src/smtp.c @@ -48,8 +48,6 @@ static gboolean smtp_write_socket (void *arg); -static sig_atomic_t wanna_die = 0; - /* Init functions */ gpointer init_smtp (struct config_file *cfg); void start_smtp (struct rspamd_worker *worker); @@ -65,67 +63,6 @@ worker_t smtp_worker = { SOCK_STREAM /* TCP socket */ }; -#ifndef HAVE_SA_SIGINFO -static void -sig_handler (gint signo) -#else -static void -sig_handler (gint signo, siginfo_t *info, void *unused) -#endif -{ - struct timeval tv; - - switch (signo) { - case SIGINT: - case SIGTERM: - if (!wanna_die) { - wanna_die = 1; - tv.tv_sec = 0; - tv.tv_usec = 0; - event_loopexit (&tv); - -#ifdef WITH_GPERF_TOOLS - ProfilerStop (); -#endif - } - break; - } -} - -/* - * Config reload is designed by sending sigusr to active workers and pending shutdown of them - */ -static void -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 */ - struct timeval tv; - if (! wanna_die) { - tv.tv_sec = SOFT_SHUTDOWN_TIME; - tv.tv_usec = 0; - event_del (&worker->sig_ev_usr1); - event_del (&worker->sig_ev_usr2); - worker_stop_accept (worker); - msg_info ("worker's shutdown is pending in %d sec", SOFT_SHUTDOWN_TIME); - event_loopexit (&tv); - } - 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 call_stage_filters (struct smtp_session *session, enum rspamd_smtp_stage stage) { @@ -967,8 +904,7 @@ start_smtp (struct rspamd_worker *worker) { struct smtp_worker_ctx *ctx = worker->ctx; - ctx->ev_base = prepare_worker (worker, "smtp_worker", sig_handler, accept_socket); - + ctx->ev_base = prepare_worker (worker, "smtp_worker", accept_socket); /* Set smtp options */ if ( !config_smtp_worker (worker)) { @@ -976,16 +912,6 @@ start_smtp (struct rspamd_worker *worker) exit (EXIT_SUCCESS); } - /* SIGUSR2 handler */ - 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); - /* Maps events */ start_map_watch (worker->srv->cfg, ctx->ev_base); diff --git a/src/smtp_proxy.c b/src/smtp_proxy.c index c4fa23605..0a3475795 100644 --- a/src/smtp_proxy.c +++ b/src/smtp_proxy.c @@ -48,7 +48,6 @@ #define SMTP_MAXERRORS 15 -static sig_atomic_t wanna_die = 0; /* Init functions */ gpointer init_smtp_proxy (struct config_file *cfg); @@ -139,67 +138,6 @@ struct smtp_proxy_session { guint errors; }; -#ifndef HAVE_SA_SIGINFO -static void -sig_handler (gint signo) -#else -static void -sig_handler (gint signo, siginfo_t *info, void *unused) -#endif -{ - struct timeval tv; - - switch (signo) { - case SIGINT: - case SIGTERM: - if (!wanna_die) { - wanna_die = 1; - tv.tv_sec = 0; - tv.tv_usec = 0; - event_loopexit (&tv); - -#ifdef WITH_GPERF_TOOLS - ProfilerStop (); -#endif - } - break; - } -} - -/* - * Config reload is designed by sending sigusr to active workers and pending shutdown of them - */ -static void -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 */ - struct timeval tv; - if (! wanna_die) { - tv.tv_sec = SOFT_SHUTDOWN_TIME; - tv.tv_usec = 0; - event_del (&worker->sig_ev_usr1); - event_del (&worker->sig_ev_usr2); - worker_stop_accept (worker); - msg_info ("worker's shutdown is pending in %d sec", SOFT_SHUTDOWN_TIME); - event_loopexit (&tv); - } - 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 void free_smtp_proxy_session (gpointer arg) { @@ -1042,7 +980,7 @@ start_smtp_proxy (struct rspamd_worker *worker) { struct smtp_proxy_ctx *ctx = worker->ctx; - ctx->ev_base = prepare_worker (worker, "smtp_proxy", sig_handler, accept_socket); + ctx->ev_base = prepare_worker (worker, "smtp_proxy", accept_socket); /* Set smtp options */ if ( !config_smtp_proxy_worker (worker)) { @@ -1050,17 +988,6 @@ start_smtp_proxy (struct rspamd_worker *worker) exit (EXIT_SUCCESS); } - - /* SIGUSR2 handler */ - 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); - /* DNS resolver */ ctx->resolver = dns_resolver_init (worker->srv->logger, ctx->ev_base, worker->srv->cfg); diff --git a/src/webui.c b/src/webui.c index 3027947bc..812cee249 100644 --- a/src/webui.c +++ b/src/webui.c @@ -128,72 +128,10 @@ struct rspamd_webui_session { gboolean is_spam; }; -static sig_atomic_t wanna_die = 0; +sig_atomic_t wanna_die = 0; /* Signal handlers */ -#ifndef HAVE_SA_SIGINFO -static void -sig_handler (gint signo) -#else -static void -sig_handler (gint signo, siginfo_t * info, void *unused) -#endif -{ - struct timeval tv; - - switch (signo) { - case SIGINT: - case SIGTERM: - if (!wanna_die) { - wanna_die = 1; - tv.tv_sec = 0; - tv.tv_usec = 0; - event_loopexit (&tv); - -#ifdef WITH_GPERF_TOOLS - ProfilerStop (); -#endif - } - break; - } -} - -/* - * Config reload is designed by sending sigusr2 to active workers and pending shutdown of them - */ -static void -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 */ - struct timeval tv; - - if (!wanna_die) { - tv.tv_sec = SOFT_SHUTDOWN_TIME; - tv.tv_usec = 0; - event_del (&worker->sig_ev_usr1); - event_del (&worker->sig_ev_usr2); - worker_stop_accept (worker); - msg_info ("worker's shutdown is pending in %d sec", SOFT_SHUTDOWN_TIME); - event_loopexit (&tv); - } - 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 void rspamd_webui_send_error (struct rspamd_http_connection_entry *entry, gint code, const gchar *error_msg) @@ -1456,19 +1394,9 @@ start_webui_worker (struct rspamd_worker *worker) { struct rspamd_webui_worker_ctx *ctx = worker->ctx; - ctx->ev_base = prepare_worker (worker, "controller", sig_handler, rspamd_webui_accept_socket); + ctx->ev_base = prepare_worker (worker, "controller", rspamd_webui_accept_socket); msec_to_tv (ctx->timeout, &ctx->io_tv); - /* SIGUSR2 handler */ - 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); - ctx->start_time = time (NULL); ctx->worker = worker; ctx->cfg = worker->srv->cfg; diff --git a/src/worker.c b/src/worker.c index 9f6e269bb..4ed990fb0 100644 --- a/src/worker.c +++ b/src/worker.c @@ -88,70 +88,6 @@ struct rspamd_worker_ctx { struct event_base *ev_base; }; -static sig_atomic_t wanna_die = 0; - -#ifndef HAVE_SA_SIGINFO -static void -sig_handler (gint signo) -#else -static void -sig_handler (gint signo, siginfo_t * info, void *unused) -#endif -{ - struct timeval tv; - - switch (signo) { - case SIGINT: - case SIGTERM: - if (!wanna_die) { - wanna_die = 1; - tv.tv_sec = 0; - tv.tv_usec = 0; - event_loopexit (&tv); - -#ifdef WITH_GPERF_TOOLS - ProfilerStop (); -#endif - } - break; - } -} - -/* - * Config reload is designed by sending sigusr2 to active workers and pending shutdown of them - */ -static void -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 */ - struct timeval tv; - - if (!wanna_die) { - tv.tv_sec = SOFT_SHUTDOWN_TIME; - tv.tv_usec = 0; - event_del (&worker->sig_ev_usr1); - event_del (&worker->sig_ev_usr2); - worker_stop_accept (worker); - msg_info ("worker's shutdown is pending in %d sec", SOFT_SHUTDOWN_TIME); - event_loopexit (&tv); - } - 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; -} - /* * Reduce number of tasks proceeded */ @@ -352,19 +288,9 @@ start_worker (struct rspamd_worker *worker) GError *err = NULL; struct lua_locked_state *nL; - ctx->ev_base = prepare_worker (worker, "normal", sig_handler, accept_socket); + ctx->ev_base = prepare_worker (worker, "normal", accept_socket); msec_to_tv (ctx->timeout, &ctx->io_tv); - /* SIGUSR2 handler */ - 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); - start_map_watch (worker->srv->cfg, ctx->ev_base); |