From bdf12859714fe0d81093bddf74d4822532bfd528 Mon Sep 17 00:00:00 2001 From: Vlad Paiu Date: Thu, 11 Jul 2013 19:15:22 +0300 Subject: [PATCH] if timeout expired in child while nothing was read - simply pass back to main otherwise, if we read only a small piece of a message, terminate the connection --- tcp_read.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tcp_read.c b/tcp_read.c index fddc0ced005..6b4bb12b413 100644 --- a/tcp_read.c +++ b/tcp_read.c @@ -977,13 +977,15 @@ static inline void tcp_receive_timeout(void) continue; } if (con->timeout<=ticks){ - /* expired, signal error & return to "tcp main" */ LM_DBG("%p expired - (%d, %d) lt=%d\n", con, con->timeout, ticks,con->lifetime); /* fd will be closed in release_tcpconn */ io_watch_del(&io_w, con->fd, -1, IO_FD_CLOSING); tcpconn_listrm(tcp_conn_lst, con, c_next, c_prev); - release_tcpconn(con, CONN_ERROR, tcpmain_sock); + if (con->msg_attempts) + release_tcpconn(con, CONN_ERROR, tcpmain_sock); + else + release_tcpconn(con, CONN_RELEASE, tcpmain_sock); } } }