mirror of
https://github.com/godotengine/godot.git
synced 2025-10-31 21:51:22 +00:00
Support multiple debug protocols.
This commit is contained in:
parent
ed225faf31
commit
d79e28c302
13 changed files with 78 additions and 41 deletions
|
|
@ -44,6 +44,7 @@ private:
|
|||
Ref<TCP_Server> server;
|
||||
|
||||
public:
|
||||
static EditorDebuggerServer *create(const String &p_protocol);
|
||||
virtual void poll() {}
|
||||
virtual Error start();
|
||||
virtual void stop();
|
||||
|
|
@ -54,6 +55,11 @@ public:
|
|||
EditorDebuggerServerTCP();
|
||||
};
|
||||
|
||||
EditorDebuggerServer *EditorDebuggerServerTCP::create(const String &p_protocol) {
|
||||
ERR_FAIL_COND_V(p_protocol != "tcp://", nullptr);
|
||||
return memnew(EditorDebuggerServerTCP);
|
||||
}
|
||||
|
||||
EditorDebuggerServerTCP::EditorDebuggerServerTCP() {
|
||||
server.instance();
|
||||
}
|
||||
|
|
@ -85,6 +91,23 @@ Ref<RemoteDebuggerPeer> EditorDebuggerServerTCP::take_connection() {
|
|||
return memnew(RemoteDebuggerPeerTCP(server->take_connection()));
|
||||
}
|
||||
|
||||
EditorDebuggerServer *EditorDebuggerServer::create_default() {
|
||||
return memnew(EditorDebuggerServerTCP);
|
||||
/// EditorDebuggerServer
|
||||
Map<StringName, EditorDebuggerServer::CreateServerFunc> EditorDebuggerServer::protocols;
|
||||
|
||||
EditorDebuggerServer *EditorDebuggerServer::create(const String &p_protocol) {
|
||||
ERR_FAIL_COND_V(!protocols.has(p_protocol), nullptr);
|
||||
return protocols[p_protocol](p_protocol);
|
||||
}
|
||||
|
||||
void EditorDebuggerServer::register_protocol_handler(const String &p_protocol, CreateServerFunc p_func) {
|
||||
ERR_FAIL_COND(protocols.has(p_protocol));
|
||||
protocols[p_protocol] = p_func;
|
||||
}
|
||||
|
||||
void EditorDebuggerServer::initialize() {
|
||||
register_protocol_handler("tcp://", EditorDebuggerServerTCP::create);
|
||||
}
|
||||
|
||||
void EditorDebuggerServer::deinitialize() {
|
||||
protocols.clear();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue