summaryrefslogtreecommitdiff
path: root/modules/websocket
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-07-28 21:49:51 +0200
committerGitHub <noreply@github.com>2019-07-28 21:49:51 +0200
commitd8e7e344bccb1ad31e987e775a502eb284f627c8 (patch)
tree965e2df7abbabbc19440705f302395f93bb30341 /modules/websocket
parent331a703f5d2b1b47c4b8312971c44ed2faae505e (diff)
parentd6c9b377b933c28ea1758e12c2258945bf201d40 (diff)
Merge pull request #30889 from Faless/ws/client_free_crash
Fix WebSocketClient crash when unref during signal
Diffstat (limited to 'modules/websocket')
-rw-r--r--modules/websocket/wsl_client.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/websocket/wsl_client.cpp b/modules/websocket/wsl_client.cpp
index 86374e8f80..af75f2a320 100644
--- a/modules/websocket/wsl_client.cpp
+++ b/modules/websocket/wsl_client.cpp
@@ -190,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;
@@ -230,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;
}
@@ -242,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;
@@ -255,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;
@@ -268,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.
}
}
@@ -277,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