Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 46acd74

Browse filesBrowse files
committed
Fix infinite loop when a Websocket connection is closed by client without closing handshake.
1 parent 31a7f86 commit 46acd74
Copy full SHA for 46acd74

File tree

Expand file treeCollapse file tree

1 file changed

+8
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-1
lines changed

‎src/HTTPConnection.cpp

Copy file name to clipboardExpand all lines: src/HTTPConnection.cpp
+8-1Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,15 @@ void HTTPConnection::loop() {
563563
HTTPS_LOGD("Calling WS handler, FID=%d", _socket);
564564
_wsHandler->loop();
565565
}
566+
567+
// If the client closed the connection unexpectedly
568+
if (_clientState == CSTATE_CLOSED) {
569+
HTTPS_LOGI("WS lost client, calling onClose, FID=%d", _socket);
570+
_wsHandler->onClose();
571+
}
572+
566573
// If the handler has terminated the connection, clean up and close the socket too
567-
if (_wsHandler->closed()) {
574+
if (_wsHandler->closed() || _clientState == CSTATE_CLOSED) {
568575
HTTPS_LOGI("WS closed, freeing Handler, FID=%d", _socket);
569576
delete _wsHandler;
570577
_wsHandler = nullptr;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.