Skip to content

Commit

Permalink
net/tcp: listen for read events after async connect
Browse files Browse the repository at this point in the history
After an async connect succeeds, the fd should also be added in reactor
for read events, otherwise these will be lost.

Many thanks go to Pete Kelly for reporting and testing!

(cherry picked from commit ca643de)
  • Loading branch information
razvancrainea committed Nov 22, 2018
1 parent 95bf163 commit 4b5e254
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions net/net_tcp.c
Expand Up @@ -1147,6 +1147,11 @@ inline static int handle_tcpconn_ev(struct tcp_connection* tcpconn, int fd_i,
tcpconn->state = S_CONN_OK;
LM_DBG("Successfully completed previous async connect\n");

/* now that we completed the async connection, we also need to
* listen for READ events, otherwise these will get lost */
if (tcpconn->flags & F_CONN_REMOVED_READ)
reactor_add_reader( tcpconn->s, F_TCPCONN, RCT_PRIO_NET, tcpconn);

goto async_write;
} else {
/* we're coming from an async write -
Expand Down

0 comments on commit 4b5e254

Please sign in to comment.