Browse Source

[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.
Fabio Alessandrelli 2 years ago
parent
commit
a5d243cac2
1 changed files with 2 additions and 0 deletions
  1. 2 0
      modules/websocket/wsl_peer.cpp

+ 2 - 0
modules/websocket/wsl_peer.cpp

@@ -104,6 +104,8 @@ void WSLPeer::Resolver::try_next_candidate(Ref<StreamPeerTCP> &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();
 		}