File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
components/esp_websocket_client Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -243,6 +243,13 @@ static esp_err_t esp_websocket_client_dispatch_event(esp_websocket_client_handle
243
243
static esp_err_t esp_websocket_client_abort_connection (esp_websocket_client_handle_t client , esp_websocket_error_type_t error_type )
244
244
{
245
245
ESP_WS_CLIENT_STATE_CHECK (TAG , client , return ESP_FAIL );
246
+
247
+ // Prevent double connection close - check if already closing or closed
248
+ if (client -> state == WEBSOCKET_STATE_CLOSING || client -> state == WEBSOCKET_STATE_UNKNOW ) {
249
+ ESP_LOGV (TAG , "Connection already closing/closed, skipping abort" );
250
+ return ESP_OK ;
251
+ }
252
+
246
253
esp_transport_close (client -> transport );
247
254
248
255
if (!client -> config -> auto_reconnect ) {
You can’t perform that action at this time.
0 commit comments