Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/HTTPConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,8 +563,15 @@ void HTTPConnection::loop() {
HTTPS_LOGD("Calling WS handler, FID=%d", _socket);
_wsHandler->loop();
}

// If the client closed the connection unexpectedly
if (_clientState == CSTATE_CLOSED) {
HTTPS_LOGI("WS lost client, calling onClose, FID=%d", _socket);
_wsHandler->onClose();
}

// If the handler has terminated the connection, clean up and close the socket too
if (_wsHandler->closed()) {
if (_wsHandler->closed() || _clientState == CSTATE_CLOSED) {
HTTPS_LOGI("WS closed, freeing Handler, FID=%d", _socket);
delete _wsHandler;
_wsHandler = nullptr;
Expand Down