fix(websocket): Close websocket and dispatch event if server does not close within a reasonable amount of time.

This commit is contained in:
Eldar Hauge Torkelsen
2024-01-29 07:50:55 +01:00
parent 2b092e0db4
commit d85311880d

View File

@ -1039,10 +1039,9 @@ static void esp_websocket_client_task(void *pv)
ESP_LOGD(TAG, " Waiting for TCP connection to be closed by the server");
int ret = esp_transport_ws_poll_connection_closed(client->transport, 1000);
if (ret == 0) {
// still waiting
continue;
}
if (ret < 0) {
ESP_LOGW(TAG, "Did not get TCP close within expected delay");
} else if (ret < 0) {
ESP_LOGW(TAG, "Connection terminated while waiting for clean TCP close");
}
client->run = false;