Update RX timestamp right after assigning socket

Otherwise the socket poll callback races with the RX timeout (if
nonzero) and will immediately disconnect the socket without waiting for
it to actually finish connecting.
This commit is contained in:
Alex Villacís Lasso
2021-08-02 16:47:07 -05:00
parent fea600a56c
commit 16292c981e

View File

@@ -496,6 +496,7 @@ bool AsyncClient::connect(IPAddress ip, uint16_t port)
xSemaphoreTakeRecursive(_asyncsock_mutex, (TickType_t)portMAX_DELAY);
_conn_state = 2;
_socket = sockfd;
_rx_last_packet = millis();
xSemaphoreGiveRecursive(_asyncsock_mutex);
// Socket is now connecting. Should become writable in asyncTcpSock task