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