rpc: Fix class hierarchy. (#6694)

This commit is contained in:
Steveice10 2023-07-13 16:29:54 -07:00 committed by GitHub
parent c10ffda91f
commit 0bedb28bdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 12 deletions

View file

@ -47,7 +47,7 @@
#include "core/hw/lcd.h" #include "core/hw/lcd.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
#include "core/movie.h" #include "core/movie.h"
#include "core/rpc/rpc_server.h" #include "core/rpc/server.h"
#include "network/network.h" #include "network/network.h"
#include "video_core/custom_textures/custom_tex_manager.h" #include "video_core/custom_textures/custom_tex_manager.h"
#include "video_core/renderer_base.h" #include "video_core/renderer_base.h"
@ -416,7 +416,7 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window,
telemetry_session = std::make_unique<Core::TelemetrySession>(); telemetry_session = std::make_unique<Core::TelemetrySession>();
rpc_server = std::make_unique<RPC::RPCServer>(*this); rpc_server = std::make_unique<RPC::Server>(*this);
service_manager = std::make_unique<Service::SM::ServiceManager>(*this); service_manager = std::make_unique<Service::SM::ServiceManager>(*this);
archive_manager = std::make_unique<Service::FS::ArchiveManager>(*this); archive_manager = std::make_unique<Service::FS::ArchiveManager>(*this);

View file

@ -33,7 +33,7 @@ class DspInterface;
} }
namespace Core::RPC { namespace Core::RPC {
class RPCServer; class Server;
} }
namespace Service { namespace Service {
@ -384,7 +384,7 @@ private:
std::shared_ptr<Frontend::ImageInterface> registered_image_interface; std::shared_ptr<Frontend::ImageInterface> registered_image_interface;
/// RPC Server for scripting support /// RPC Server for scripting support
std::unique_ptr<RPC::RPCServer> rpc_server; std::unique_ptr<RPC::Server> rpc_server;
std::unique_ptr<Service::FS::ArchiveManager> archive_manager; std::unique_ptr<Service::FS::ArchiveManager> archive_manager;

View file

@ -10,7 +10,7 @@
namespace Core::RPC { namespace Core::RPC {
RPCServer::RPCServer(Core::System& system_) : system{system_}, server{*this} { RPCServer::RPCServer(Core::System& system_) : system{system_} {
LOG_INFO(RPC_Server, "Starting RPC server."); LOG_INFO(RPC_Server, "Starting RPC server.");
request_handler_thread = request_handler_thread =
std::jthread([this](std::stop_token stop_token) { HandleRequestsLoop(stop_token); }); std::jthread([this](std::stop_token stop_token) { HandleRequestsLoop(stop_token); });

View file

@ -9,7 +9,6 @@
#include <span> #include <span>
#include "common/polyfill_thread.h" #include "common/polyfill_thread.h"
#include "common/threadsafe_queue.h" #include "common/threadsafe_queue.h"
#include "core/rpc/server.h"
namespace Core { namespace Core {
class System; class System;
@ -36,7 +35,6 @@ private:
private: private:
Core::System& system; Core::System& system;
Server server;
Common::SPSCQueue<std::unique_ptr<Packet>, true> request_queue; Common::SPSCQueue<std::unique_ptr<Packet>, true> request_queue;
std::jthread request_handler_thread; std::jthread request_handler_thread;
}; };

View file

@ -2,7 +2,7 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <functional> #include "core/core.h"
#include "core/rpc/packet.h" #include "core/rpc/packet.h"
#include "core/rpc/rpc_server.h" #include "core/rpc/rpc_server.h"
#include "core/rpc/server.h" #include "core/rpc/server.h"
@ -10,7 +10,7 @@
namespace Core::RPC { namespace Core::RPC {
Server::Server(RPCServer& rpc_server) : rpc_server(rpc_server) { Server::Server(Core::System& system_) : rpc_server{system_} {
const auto callback = [this](std::unique_ptr<Packet> new_request) { const auto callback = [this](std::unique_ptr<Packet> new_request) {
NewRequestCallback(std::move(new_request)); NewRequestCallback(std::move(new_request));
}; };

View file

@ -5,22 +5,26 @@
#pragma once #pragma once
#include <memory> #include <memory>
#include "core/rpc/rpc_server.h"
namespace Core {
class System;
}
namespace Core::RPC { namespace Core::RPC {
class RPCServer;
class UDPServer; class UDPServer;
class Packet; class Packet;
class Server { class Server {
public: public:
explicit Server(RPCServer& rpc_server); explicit Server(Core::System& system_);
~Server(); ~Server();
void NewRequestCallback(std::unique_ptr<Packet> new_request); void NewRequestCallback(std::unique_ptr<Packet> new_request);
private: private:
RPCServer& rpc_server; RPCServer rpc_server;
std::unique_ptr<UDPServer> udp_server; std::unique_ptr<UDPServer> udp_server;
}; };