From ccbf13ed1b74e643b0129a0cafff600d296ffe90 Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Tue, 5 Oct 2021 19:52:24 +0200 Subject: tcp: Drop EPOLLOUT for connections being established earlier That's the first thing we have to do, before sending SYN, ACK: if tcp_send_to_tap() fails, we'll get a lot of useless events otherwise. Signed-off-by: Stefano Brivio --- tcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tcp.c') diff --git a/tcp.c b/tcp.c index bf7c610..9bb2efe 100644 --- a/tcp.c +++ b/tcp.c @@ -2656,6 +2656,9 @@ static void tcp_connect_finish(struct ctx *c, struct tcp_tap_conn *conn, socklen_t sl; int so; + /* Drop EPOLLOUT, only used to wait for connect() to complete */ + tcp_tap_epoll_mask(c, conn, EPOLLIN | EPOLLRDHUP); + sl = sizeof(so); if (getsockopt(conn->sock, SOL_SOCKET, SO_ERROR, &so, &sl) || so) { tcp_rst(c, conn); @@ -2665,9 +2668,6 @@ static void tcp_connect_finish(struct ctx *c, struct tcp_tap_conn *conn, if (tcp_send_to_tap(c, conn, SYN | ACK, now)) return; - /* Drop EPOLLOUT, only used to wait for connect() to complete */ - tcp_tap_epoll_mask(c, conn, EPOLLIN | EPOLLRDHUP); - tcp_tap_state(conn, TAP_SYN_RCVD); } -- cgit v1.2.3