1
0
mirror of https://passt.top/passt synced 2024-07-03 00:12:41 +00:00

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 <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-05-21 11:14:42 +02:00
parent 8358400b3f
commit 7e3e36b2c2

2
tcp.c
View File

@ -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);
}
}
}