1
0
mirror of https://passt.top/passt synced 2024-12-22 13:45:32 +00:00

pasta, tcp: Mask EPOLLIN and EPOLLRDHUP after sending FIN

Now that we dropped EPOLLET, we'll keep getting EPOLLRDHUP, and
possibly EPOLLIN, even if there's nothing to read anymore.

Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
Stefano Brivio 2021-09-16 08:41:19 +02:00
parent 492b58d64b
commit 62bace390b

16
tcp.c
View File

@ -2735,8 +2735,14 @@ eintr:
if (move_from == conn->from && if (move_from == conn->from &&
conn->from_read == conn->from_written) { conn->from_read == conn->from_written) {
if (!conn->from_fin_sent) { if (!conn->from_fin_sent) {
shutdown(move_to, SHUT_WR); shutdown(conn->to, SHUT_WR);
conn->from_fin_sent = 1; conn->from_fin_sent = 1;
ev.events = 0;
ref.s = move_from;
ev.data.u64 = ref.u64,
epoll_ctl(c->epollfd, EPOLL_CTL_MOD,
move_from, &ev);
} }
if (conn->to_fin_sent) if (conn->to_fin_sent)
@ -2744,8 +2750,14 @@ eintr:
} else if (move_from == conn->to && } else if (move_from == conn->to &&
conn->to_read == conn->to_written) { conn->to_read == conn->to_written) {
if (!conn->to_fin_sent) { if (!conn->to_fin_sent) {
shutdown(move_to, SHUT_WR); shutdown(conn->from, SHUT_WR);
conn->to_fin_sent = 1; conn->to_fin_sent = 1;
ev.events = 0;
ref.s = move_from;
ev.data.u64 = ref.u64,
epoll_ctl(c->epollfd, EPOLL_CTL_MOD,
move_from, &ev);
} }
if (conn->from_fin_sent) if (conn->from_fin_sent)