diff --git a/components/esp_websocket_client/esp_websocket_client.c b/components/esp_websocket_client/esp_websocket_client.c index 0aeb40f73f7..0c4d1eb702d 100644 --- a/components/esp_websocket_client/esp_websocket_client.c +++ b/components/esp_websocket_client/esp_websocket_client.c @@ -1083,7 +1083,9 @@ static void esp_websocket_client_task(void *pv) } else { esp_websocket_client_error(client, "esp_transport_poll_read() returned %d, errno=%d", read_select, errno); } + xSemaphoreTakeRecursive(client->lock, lock_timeout); esp_websocket_client_abort_connection(client, WEBSOCKET_ERROR_TYPE_TCP_TRANSPORT); + xSemaphoreGiveRecursive(client->lock); } } else if (WEBSOCKET_STATE_WAIT_TIMEOUT == client->state) { // waiting for reconnecting...