Skip to content

Commit

Permalink
fix(websocket): Close websocket and dispatch event if server does not…
Browse files Browse the repository at this point in the history
… close within a reasonable amount of time.
  • Loading branch information
eht-datarespons authored and suren-gabrielyan-espressif committed Feb 19, 2024
1 parent 069f71e commit 3090442
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions components/esp_websocket_client/esp_websocket_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3090442

Please sign in to comment.