Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: tcp: Fix corner case with closed listener
There was a corner case which was not handled well in a scenario, when listening socket was closed during an active handshake with a new client. When a listening socket is closed, the accept callback is cleared on the TCP context. If this happened during a handshake with a new client, i. e. before final ACK from the client was processed, this lead to a context leak, as application did not take ownership of the connection (i. e. had no means to close it). Fix this, by proactively closing the connection at the TCP level when no accept_cb is available. Instead of ignoring the fact that no accept_cb is available, the TCP stack will now enter TCP_FIN_WAIT_1 state and proceed with a graceful teardown of the connection. Signed-off-by: Robert Lubos <[email protected]>
- Loading branch information