summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-10-17 17:32:16 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-10-17 17:32:16 +0200
commit28a4eec9a77bc797b7147be2453cdbe85cf47d7f (patch)
tree4656f5b9e7a6fc7c1cac1d20c83b97c61e8ddab9
parentb545d55df9665a4be1677a9f0c7601f27e2d3371 (diff)
parentadb3d2338e69fb6c90a2b52025d319dbd8f23036 (diff)
Merge pull request #67532 from Faless/ws/4.x_fix_poll
[WebSocket] Fix client failing to connect to direct IP.
-rw-r--r--modules/websocket/wsl_peer.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/websocket/wsl_peer.cpp b/modules/websocket/wsl_peer.cpp
index 4930b178ec..84e022182e 100644
--- a/modules/websocket/wsl_peer.cpp
+++ b/modules/websocket/wsl_peer.cpp
@@ -320,7 +320,9 @@ void WSLPeer::_do_client_handshake() {
}
tcp->poll();
- if (tcp->get_status() != StreamPeerTCP::STATUS_CONNECTED) {
+ if (tcp->get_status() == StreamPeerTCP::STATUS_CONNECTING) {
+ return; // Keep connecting.
+ } else if (tcp->get_status() != StreamPeerTCP::STATUS_CONNECTED) {
close(-1); // Failed to connect.
return;
}
@@ -511,7 +513,7 @@ Error WSLPeer::connect_to_url(const String &p_url, bool p_verify_tls, Ref<X509Ce
resolver.start(host, port);
resolver.try_next_candidate(tcp);
- if (tcp->get_status() != StreamPeerTCP::STATUS_CONNECTING && !resolver.has_more_candidates()) {
+ if (tcp->get_status() != StreamPeerTCP::STATUS_CONNECTING && tcp->get_status() != StreamPeerTCP::STATUS_CONNECTED && !resolver.has_more_candidates()) {
_clear();
return FAILED;
}