Skip to content

Commit

Permalink
if timeout expired in child while nothing was read - simply pass back…
Browse files Browse the repository at this point in the history
… to main

otherwise, if we read only a small piece of a message, terminate the connection
  • Loading branch information
vladpaiu committed Jul 11, 2013
1 parent 6d8fef7 commit bdf1285
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tcp_read.c
Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit bdf1285

Please sign in to comment.