diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-09-14 16:20:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-14 16:20:02 +0200 |
commit | 3cc01b2824c01d2f231f8a3179cc55cad4b2f4ef (patch) | |
tree | 1f31d4c48ac0888e07568e73582f3caaac661d76 /modules/websocket | |
parent | 1cec7057bfb2eea0f1c3ac5ab3731f279002e244 (diff) | |
parent | 4123612eeb54b8cf1e689be05c01fc1ead972d36 (diff) |
Merge pull request #52226 from Faless/debugger/4.x_start_options
Diffstat (limited to 'modules/websocket')
-rw-r--r-- | modules/websocket/editor_debugger_server_websocket.cpp | 14 | ||||
-rw-r--r-- | modules/websocket/editor_debugger_server_websocket.h | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/modules/websocket/editor_debugger_server_websocket.cpp b/modules/websocket/editor_debugger_server_websocket.cpp index 2e61cbfc08..d248433d82 100644 --- a/modules/websocket/editor_debugger_server_websocket.cpp +++ b/modules/websocket/editor_debugger_server_websocket.cpp @@ -48,11 +48,19 @@ void EditorDebuggerServerWebSocket::poll() { server->poll(); } -Error EditorDebuggerServerWebSocket::start() { - int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); +Error EditorDebuggerServerWebSocket::start(const String &p_uri) { + int bind_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port"); + String bind_host = EditorSettings::get_singleton()->get("network/debug/remote_host"); + if (!p_uri.is_empty() && p_uri != "ws://") { + String scheme, path; + Error err = p_uri.parse_url(scheme, bind_host, bind_port, path); + ERR_FAIL_COND_V(err != OK, ERR_INVALID_PARAMETER); + ERR_FAIL_COND_V(!bind_host.is_valid_ip_address() && bind_host != "*", ERR_INVALID_PARAMETER); + } + server->set_bind_ip(bind_host); Vector<String> compatible_protocols; compatible_protocols.push_back("binary"); // compatibility with EMSCRIPTEN TCP-to-WebSocket layer. - return server->listen(remote_port, compatible_protocols); + return server->listen(bind_port, compatible_protocols); } void EditorDebuggerServerWebSocket::stop() { diff --git a/modules/websocket/editor_debugger_server_websocket.h b/modules/websocket/editor_debugger_server_websocket.h index d9543bb647..14ab0109b2 100644 --- a/modules/websocket/editor_debugger_server_websocket.h +++ b/modules/websocket/editor_debugger_server_websocket.h @@ -48,7 +48,7 @@ public: void _peer_disconnected(int p_peer, bool p_was_clean); void poll() override; - Error start() override; + Error start(const String &p_uri) override; void stop() override; bool is_active() const override; bool is_connection_available() const override; |