[WebSocket] Allow reusing closing and closed peers
This commit is contained in:
parent
26d1577f39
commit
acba901087
2 changed files with 5 additions and 3 deletions
|
@ -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) {
|
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(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();
|
_clear();
|
||||||
|
|
||||||
String host;
|
String host;
|
||||||
|
|
|
@ -124,8 +124,8 @@ void WSLPeer::Resolver::try_next_candidate(Ref<StreamPeerTCP> &p_tcp) {
|
||||||
/// Server functions
|
/// Server functions
|
||||||
///
|
///
|
||||||
Error WSLPeer::accept_stream(Ref<StreamPeer> p_stream) {
|
Error WSLPeer::accept_stream(Ref<StreamPeer> p_stream) {
|
||||||
ERR_FAIL_COND_V(wsl_ctx || tcp.is_valid(), ERR_ALREADY_IN_USE);
|
|
||||||
ERR_FAIL_COND_V(p_stream.is_null(), ERR_INVALID_PARAMETER);
|
ERR_FAIL_COND_V(p_stream.is_null(), ERR_INVALID_PARAMETER);
|
||||||
|
ERR_FAIL_COND_V(ready_state != STATE_CLOSED && ready_state != STATE_CLOSING, ERR_ALREADY_IN_USE);
|
||||||
|
|
||||||
_clear();
|
_clear();
|
||||||
|
|
||||||
|
@ -471,9 +471,9 @@ bool WSLPeer::_verify_server_response() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Error WSLPeer::connect_to_url(const String &p_url, Ref<TLSOptions> p_options) {
|
Error WSLPeer::connect_to_url(const String &p_url, Ref<TLSOptions> p_options) {
|
||||||
ERR_FAIL_COND_V(wsl_ctx || tcp.is_valid(), ERR_ALREADY_IN_USE);
|
|
||||||
ERR_FAIL_COND_V(p_url.is_empty(), ERR_INVALID_PARAMETER);
|
ERR_FAIL_COND_V(p_url.is_empty(), ERR_INVALID_PARAMETER);
|
||||||
ERR_FAIL_COND_V(p_options.is_valid() && p_options->is_server(), ERR_INVALID_PARAMETER);
|
ERR_FAIL_COND_V(p_options.is_valid() && p_options->is_server(), ERR_INVALID_PARAMETER);
|
||||||
|
ERR_FAIL_COND_V(ready_state != STATE_CLOSED && ready_state != STATE_CLOSING, ERR_ALREADY_IN_USE);
|
||||||
|
|
||||||
_clear();
|
_clear();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue