src: timeout check fix

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2017-11-05 16:17:56 +01:00
parent 9646225ae9
commit 6af77bf0f1

View File

@ -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<n; i++){