From 6af77bf0f10b5af7464ea2e54348ac0e2477217d Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Sun, 5 Nov 2017 16:17:56 +0100 Subject: [PATCH] src: timeout check fix Signed-off-by: Janos SUTO --- src/piler-smtp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/piler-smtp.c b/src/piler-smtp.c index 5e024a72..7d8f7b35 100644 --- a/src/piler-smtp.c +++ b/src/piler-smtp.c @@ -182,8 +182,6 @@ int main(int argc, char **argv){ set_signal_handler(SIGALRM, check_for_client_timeout); set_signal_handler(SIGHUP, initialise_configuration); - alarm(timeout); - // calloc() initialitizes the allocated memory sessions = calloc(cfg.max_connections, sizeof(struct smtp_session)); @@ -202,6 +200,8 @@ int main(int argc, char **argv){ if(daemonise == 1 && daemon(1, 0) == -1) fatal(ERR_DAEMON); #endif + alarm(timeout); + for(;;){ n = epoll_wait(efd, events, cfg.max_connections, -1); for(i=0; i