This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit e66797bc85497f603ba8b9db834b150d60d27c4b Author: Marco Casaroli <[email protected]> AuthorDate: Fri Nov 20 13:54:17 2026 +0100 net/tcp: Keep the parent of a pending connection that listen() moves. listen() again on a listening socket moves the pending connections to the new backlog. tcp_backlogremove() takes each one from the old backlog and sets its blparent to NULL, and the move did not set it again. tcp_input() uses blparent to take a pending connection that the peer resets out of the backlog and to free it. Without it, a moved connection that the peer resets stays in the new backlog as a closed connection: it holds a slot until accept() or the close of the listener, and the SYN of the next client is dropped while the backlog is full. The move now sets blparent to the listener again. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- net/tcp/tcp_backlog.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/tcp/tcp_backlog.c b/net/tcp/tcp_backlog.c index 1a9a7963d93..1a63a690b57 100644 --- a/net/tcp/tcp_backlog.c +++ b/net/tcp/tcp_backlog.c @@ -130,6 +130,13 @@ int tcp_backlogcreate(FAR struct tcp_conn_s *conn, int nblg) blc = (FAR struct tcp_blcontainer_s *)sq_remfirst(&bls->bl_free); blc->bc_conn = blconn; sq_addlast(&blc->bc_node, &bls->bl_pending); + + /* tcp_backlogremove() cleared the parent. Set it again: the input + * path uses it to take a pending connection that the peer resets out + * of the backlog. + */ + + blconn->blparent = conn; } tcp_backlogdestroy(conn);
