Support multiple debug protocols.
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user