summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2019-06-04 07:37:57 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2019-06-19 11:45:45 +0200
commit108de5a734e1328c54babba7f805c719537b9c30 (patch)
tree250aae65711a291dbcdf0b722f38166ea1707b25
parent774a9fde84a0282c40da1dd891b613ed200ff9a8 (diff)
Editor debugger now always handle connections.
The editor debugger used to only take the first client connection, leaving potential new connections hanging until TCP timeout. This caused a lock after some time when running multiple game/editor instances, as the client will fill the write buffer, and then lock until timeout (as the editor server would never read from that socket). The editor now drops new connections immediately if it is already connected to a client.
-rw-r--r--editor/script_editor_debugger.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp
index 621ab039f4..38d9db527a 100644
--- a/editor/script_editor_debugger.cpp
+++ b/editor/script_editor_debugger.cpp
@@ -1132,10 +1132,13 @@ void ScriptEditorDebugger::_notification(int p_what) {
last_warning_count = warning_count;
}
- if (connection.is_null()) {
-
- if (server->is_connection_available()) {
-
+ if (server->is_connection_available()) {
+ if (connection.is_valid()) {
+ // We already have a valid connection. Disconnecting any new connecting client to prevent it from hanging.
+ // (If we don't keep a reference to the connection it will be destroyed and disconnect_from_host will be called internally)
+ server->take_connection();
+ } else {
+ // We just got the first connection.
connection = server->take_connection();
if (connection.is_null())
break;
@@ -1169,12 +1172,11 @@ void ScriptEditorDebugger::_notification(int p_what) {
if (profiler->is_profiling()) {
_profiler_activate(true);
}
-
- } else {
-
- break;
}
- };
+ }
+
+ if (connection.is_null())
+ break;
if (!connection->is_connected_to_host()) {
stop();