Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Commit d4c9bcd

Browse files
committed
Prevent spurious RX timeout/close on incoming socket object
When accepting a socket from an incoming connection, the internal fd was assigned without updating the field for last RX activity. If the remote side did *not* immediately write to the connection, or otherwise the socket could not be internally checked for incoming data, AND the higher-level code set up a RX timeout value, the 125-ms interval polling might evaluate the socket RX timeout condition with a last RX activity timestamp of zero (as per the default constructor). This caused a spurious RX timeout and incorrect socket closing. Fixed by initializing the field when the new incoming connection socket is accepted.
1 parent f828ec1 commit d4c9bcd

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

src/AsyncTCP.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ AsyncClient::AsyncClient(int sockfd)
307307
xSemaphoreTakeRecursive(_asyncsock_mutex, (TickType_t)portMAX_DELAY);
308308
_conn_state = 4;
309309
_socket = sockfd;
310+
_rx_last_packet = millis();
310311
xSemaphoreGiveRecursive(_asyncsock_mutex);
311312
}
312313
}

0 commit comments

Comments
 (0)