diff options
Diffstat (limited to 'src/worker.c')
-rw-r--r-- | src/worker.c | 76 |
1 files changed, 1 insertions, 75 deletions
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); |