Skip to content

Commit 37933e3

Browse files
Merge pull request #321 from ESP32Async/close
Cleanup close(bool) calls
2 parents 0c9444a + 2506e9c commit 37933e3

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/AsyncEventSource.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ void AsyncEventSourceClient::_onPoll() {
285285

286286
void AsyncEventSourceClient::_onTimeout(uint32_t time __attribute__((unused))) {
287287
if (_client) {
288-
_client->close(true);
288+
_client->close();
289289
}
290290
}
291291

src/AsyncWebSocket.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,12 @@ void AsyncWebSocketClient::_onAck(size_t len, uint32_t time) {
311311
#ifdef ESP32
312312
/*
313313
Unlocking has to be called before return execution otherwise std::unique_lock ::~unique_lock() will get an exception pthread_mutex_unlock.
314-
Due to _client->close(true) shall call the callback function _onDisconnect()
314+
Due to _client->close() shall call the callback function _onDisconnect()
315315
The calling flow _onDisconnect() --> _handleDisconnect() --> ~AsyncWebSocketClient()
316316
*/
317317
lock.unlock();
318318
#endif
319-
_client->close(true);
319+
_client->close();
320320
}
321321
return;
322322
}
@@ -423,12 +423,12 @@ bool AsyncWebSocketClient::_queueMessage(AsyncWebSocketSharedBuffer buffer, uint
423423
#ifdef ESP32
424424
/*
425425
Unlocking has to be called before return execution otherwise std::unique_lock ::~unique_lock() will get an exception pthread_mutex_unlock.
426-
Due to _client->close(true) shall call the callback function _onDisconnect()
426+
Due to _client->close() shall call the callback function _onDisconnect()
427427
The calling flow _onDisconnect() --> _handleDisconnect() --> ~AsyncWebSocketClient()
428428
*/
429429
lock.unlock();
430430
#endif
431-
_client->close(true);
431+
_client->close();
432432
}
433433

434434
async_ws_log_e("Too many messages queued: closing connection");
@@ -497,7 +497,7 @@ void AsyncWebSocketClient::_onTimeout(uint32_t time) {
497497
}
498498
// Serial.println("onTime");
499499
(void)time;
500-
_client->close(true);
500+
_client->close();
501501
}
502502

503503
void AsyncWebSocketClient::_onDisconnect() {
@@ -582,7 +582,7 @@ void AsyncWebSocketClient::_onData(void *pbuf, size_t plen) {
582582
if (_status == WS_DISCONNECTING) {
583583
_status = WS_DISCONNECTED;
584584
if (_client) {
585-
_client->close(true);
585+
_client->close();
586586
}
587587
} else {
588588
_status = WS_DISCONNECTING;
@@ -1287,7 +1287,7 @@ AsyncWebSocketResponse::AsyncWebSocketResponse(const String &key, AsyncWebSocket
12871287

12881288
void AsyncWebSocketResponse::_respond(AsyncWebServerRequest *request) {
12891289
if (_state == RESPONSE_FAILED) {
1290-
request->client()->close(true);
1290+
request->client()->close();
12911291
return;
12921292
}
12931293
String out;

src/WebResponses.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest *request, size_t len, u
482482
if (!_sendContentLength || _ackedLength >= _writtenLength) {
483483
_state = RESPONSE_END;
484484
if (!_chunked && !_sendContentLength) {
485-
request->client()->close(true);
485+
request->client()->close();
486486
}
487487
}
488488
}

0 commit comments

Comments
 (0)