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:
parent
8358400b3f
commit
7e3e36b2c2
1 changed files with 2 additions and 0 deletions
2
tcp.c
2
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_data_from_sock(c, s, now);
|
||||||
tcp_send_to_tap(c, s, FIN | ACK, NULL, 0);
|
tcp_send_to_tap(c, s, FIN | ACK, NULL, 0);
|
||||||
tcp_sock_consume(s, tc[s].seq_ack_from_tap);
|
tcp_sock_consume(s, tc[s].seq_ack_from_tap);
|
||||||
|
} else {
|
||||||
|
tcp_close_and_epoll_del(c, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue