diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2024-07-10 12:49:27 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2024-07-10 12:56:40 +0200 |
commit | acba9010877a8bfcbf06fecfe8f74e2258ec98ba (patch) | |
tree | c1f8b5d03351de1405d689bdeeb2a4311bba5dfb /modules/websocket/emws_peer.cpp | |
parent | 26d1577f3985363faab48a65e9a0d9eed0e26d86 (diff) | |
download | redot-engine-acba9010877a8bfcbf06fecfe8f74e2258ec98ba.tar.gz |
[WebSocket] Allow reusing closing and closed peers
Diffstat (limited to 'modules/websocket/emws_peer.cpp')
-rw-r--r-- | modules/websocket/emws_peer.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/modules/websocket/emws_peer.cpp b/modules/websocket/emws_peer.cpp index 329e5bd532..03a530909b 100644 --- a/modules/websocket/emws_peer.cpp +++ b/modules/websocket/emws_peer.cpp @@ -59,8 +59,10 @@ void EMWSPeer::_esws_on_close(void *p_obj, int p_code, const char *p_reason, int } Error EMWSPeer::connect_to_url(const String &p_url, Ref<TLSOptions> p_tls_options) { + ERR_FAIL_COND_V(p_url.is_empty(), ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(p_tls_options.is_valid() && p_tls_options->is_server(), ERR_INVALID_PARAMETER); - ERR_FAIL_COND_V(ready_state != STATE_CLOSED, ERR_ALREADY_IN_USE); + ERR_FAIL_COND_V(ready_state != STATE_CLOSED && ready_state != STATE_CLOSING, ERR_ALREADY_IN_USE); + _clear(); String host; |