summaryrefslogtreecommitdiff
path: root/modules/websocket
diff options
context:
space:
mode:
Diffstat (limited to 'modules/websocket')
-rw-r--r--modules/websocket/wsl_client.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/modules/websocket/wsl_client.cpp b/modules/websocket/wsl_client.cpp
index b2d865a58f..af75f2a320 100644
--- a/modules/websocket/wsl_client.cpp
+++ b/modules/websocket/wsl_client.cpp
@@ -92,6 +92,7 @@ void WSLClient::_do_handshake() {
data->id = 1;
_peer->make_context(data, _in_buf_size, _in_pkt_size, _out_buf_size, _out_pkt_size);
_on_connect(protocol);
+ break;
}
_resp_pos += 1;
}
@@ -189,8 +190,8 @@ Error WSLClient::connect_to_host(String p_host, String p_path, uint16_t p_port,
Error err = _tcp->connect_to_host(addr, p_port);
if (err != OK) {
- _on_error();
_tcp->disconnect_from_host();
+ _on_error();
return err;
}
_connection = _tcp;
@@ -229,8 +230,8 @@ void WSLClient::poll() {
if (_peer->is_connected_to_host()) {
_peer->poll();
if (!_peer->is_connected_to_host()) {
- _on_disconnect(_peer->close_code != -1);
disconnect_from_host();
+ _on_disconnect(_peer->close_code != -1);
}
return;
}
@@ -241,8 +242,8 @@ void WSLClient::poll() {
switch (_tcp->get_status()) {
case StreamPeerTCP::STATUS_NONE:
// Clean close
- _on_error();
disconnect_from_host();
+ _on_error();
break;
case StreamPeerTCP::STATUS_CONNECTED: {
Ref<StreamPeerSSL> ssl;
@@ -254,8 +255,8 @@ void WSLClient::poll() {
ERR_FAIL_COND(ssl.is_null());
ssl->set_blocking_handshake_enabled(false);
if (ssl->connect_to_stream(_tcp, verify_ssl, _host) != OK) {
- _on_error();
disconnect_from_host();
+ _on_error();
return;
}
_connection = ssl;
@@ -267,8 +268,8 @@ void WSLClient::poll() {
if (ssl->get_status() == StreamPeerSSL::STATUS_HANDSHAKING)
return; // Need more polling.
else if (ssl->get_status() != StreamPeerSSL::STATUS_CONNECTED) {
- _on_error();
disconnect_from_host();
+ _on_error();
return; // Error.
}
}
@@ -276,8 +277,8 @@ void WSLClient::poll() {
_do_handshake();
} break;
case StreamPeerTCP::STATUS_ERROR:
- _on_error();
disconnect_from_host();
+ _on_error();
break;
case StreamPeerTCP::STATUS_CONNECTING:
break; // Wait for connection