From 7e3e36b2c2d6cc233958aa10da8ef703c693f0b9 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Fri, 21 May 2021 11:14:42 +0200 Subject: tcp: Close socket on EPOLLHUP or EPOLLRDHUP in non-data state If the peer doesn't shut down orderly, this might happen: just close the socket then. Signed-off-by: Stefano Brivio --- tcp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tcp.c b/tcp.c index 3c92d37..bab07ab 100644 --- a/tcp.c +++ b/tcp.c @@ -1465,6 +1465,8 @@ void tcp_sock_handler(struct ctx *c, int s, uint32_t events, char *pkt_buf, tcp_data_from_sock(c, s, now); tcp_send_to_tap(c, s, FIN | ACK, NULL, 0); tcp_sock_consume(s, tc[s].seq_ack_from_tap); + } else { + tcp_close_and_epoll_del(c, s); } } } -- cgit v1.2.3