From 9646225ae9a7db4b76d143c42c6d2c5f8cf00236 Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Sun, 5 Nov 2017 08:35:01 +0100 Subject: [PATCH] src: fixing aborted connection handling, mostly from o365 Signed-off-by: Janos SUTO --- src/piler-smtp.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/piler-smtp.c b/src/piler-smtp.c index 7eade8d6..5e024a72 100644 --- a/src/piler-smtp.c +++ b/src/piler-smtp.c @@ -206,12 +206,17 @@ int main(int argc, char **argv){ n = epoll_wait(efd, events, cfg.max_connections, -1); for(i=0; i= _LOG_EXTREME) syslog(LOG_PRIORITY, "ERROR: the remote end hung up without sending QUIT"); - close(events[i].data.fd); + session = get_session_by_socket(sessions, cfg.max_connections, events[i].data.fd); + if(session) + tear_down_session(sessions, session->slot, &num_connections); + else + close(events[i].data.fd); continue; }