From a5d243cac235709093ee6d77f85836a8dd6dc17e Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Thu, 13 Oct 2022 14:24:54 +0200 Subject: [PATCH] [WebSocket] Fix TCP connection being closed while connecting. Fix a bug causing the WebSocketPeer to fail connecting to a remote server when the TCP 3-way handshake took more than a few milliseconds. --- modules/websocket/wsl_peer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/websocket/wsl_peer.cpp b/modules/websocket/wsl_peer.cpp index 4c8e661f675..4930b178eca 100644 --- a/modules/websocket/wsl_peer.cpp +++ b/modules/websocket/wsl_peer.cpp @@ -104,6 +104,8 @@ void WSLPeer::Resolver::try_next_candidate(Ref &p_tcp) { p_tcp->set_no_delay(true); ip_candidates.clear(); return; + } else if (status == StreamPeerTCP::STATUS_CONNECTING) { + return; // Keep connecting. } else { p_tcp->disconnect_from_host(); }