Browse Source

Editor now shows error when debug port is in use

(cherry picked from commit fc1368bee00301ef7c789982474876c5a6ea9854)
Fabio Alessandrelli 8 years ago
parent
commit
f6f8628ec9
1 changed files with 5 additions and 2 deletions
  1. 5 2
      editor/script_editor_debugger.cpp

+ 5 - 2
editor/script_editor_debugger.cpp

@@ -1029,14 +1029,17 @@ void ScriptEditorDebugger::start() {
 		EditorNode::get_singleton()->make_bottom_panel_item_visible(this);
 	}
 
-	uint16_t port = GLOBAL_DEF("debug/remote_port", 6007);
 	perf_history.clear();
 	for (int i = 0; i < Performance::MONITOR_MAX; i++) {
 
 		perf_max[i] = 0;
 	}
 
-	server->listen(port);
+	int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
+	if (server->listen(remote_port) != OK) {
+		EditorNode::get_log()->add_message(String("** Error listening on port ") + itos(remote_port) + String(" **"));
+		return;
+	}
 	set_process(true);
 }