From 0bedb28bdc5084a504aeb5a95da3221f8170c6ec Mon Sep 17 00:00:00 2001 From: Steveice10 <1269164+Steveice10@users.noreply.github.com> Date: Thu, 13 Jul 2023 16:29:54 -0700 Subject: [PATCH] rpc: Fix class hierarchy. (#6694) --- src/core/core.cpp | 4 ++-- src/core/core.h | 4 ++-- src/core/rpc/rpc_server.cpp | 2 +- src/core/rpc/rpc_server.h | 2 -- src/core/rpc/server.cpp | 4 ++-- src/core/rpc/server.h | 10 +++++++--- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/core/core.cpp b/src/core/core.cpp index 35bcca994..703b49fba 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -47,7 +47,7 @@ #include "core/hw/lcd.h" #include "core/loader/loader.h" #include "core/movie.h" -#include "core/rpc/rpc_server.h" +#include "core/rpc/server.h" #include "network/network.h" #include "video_core/custom_textures/custom_tex_manager.h" #include "video_core/renderer_base.h" @@ -416,7 +416,7 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, telemetry_session = std::make_unique(); - rpc_server = std::make_unique(*this); + rpc_server = std::make_unique(*this); service_manager = std::make_unique(*this); archive_manager = std::make_unique(*this); diff --git a/src/core/core.h b/src/core/core.h index f73be6524..fc9bba1e7 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -33,7 +33,7 @@ class DspInterface; } namespace Core::RPC { -class RPCServer; +class Server; } namespace Service { @@ -384,7 +384,7 @@ private: std::shared_ptr registered_image_interface; /// RPC Server for scripting support - std::unique_ptr rpc_server; + std::unique_ptr rpc_server; std::unique_ptr archive_manager; diff --git a/src/core/rpc/rpc_server.cpp b/src/core/rpc/rpc_server.cpp index b9114be82..4dd9c2e76 100644 --- a/src/core/rpc/rpc_server.cpp +++ b/src/core/rpc/rpc_server.cpp @@ -10,7 +10,7 @@ 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."); request_handler_thread = std::jthread([this](std::stop_token stop_token) { HandleRequestsLoop(stop_token); }); diff --git a/src/core/rpc/rpc_server.h b/src/core/rpc/rpc_server.h index 04b4371c9..f34d97059 100644 --- a/src/core/rpc/rpc_server.h +++ b/src/core/rpc/rpc_server.h @@ -9,7 +9,6 @@ #include #include "common/polyfill_thread.h" #include "common/threadsafe_queue.h" -#include "core/rpc/server.h" namespace Core { class System; @@ -36,7 +35,6 @@ private: private: Core::System& system; - Server server; Common::SPSCQueue, true> request_queue; std::jthread request_handler_thread; }; diff --git a/src/core/rpc/server.cpp b/src/core/rpc/server.cpp index ed93dac04..9ed278802 100644 --- a/src/core/rpc/server.cpp +++ b/src/core/rpc/server.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include +#include "core/core.h" #include "core/rpc/packet.h" #include "core/rpc/rpc_server.h" #include "core/rpc/server.h" @@ -10,7 +10,7 @@ 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 new_request) { NewRequestCallback(std::move(new_request)); }; diff --git a/src/core/rpc/server.h b/src/core/rpc/server.h index 46028e99b..af6e42053 100644 --- a/src/core/rpc/server.h +++ b/src/core/rpc/server.h @@ -5,22 +5,26 @@ #pragma once #include +#include "core/rpc/rpc_server.h" + +namespace Core { +class System; +} namespace Core::RPC { -class RPCServer; class UDPServer; class Packet; class Server { public: - explicit Server(RPCServer& rpc_server); + explicit Server(Core::System& system_); ~Server(); void NewRequestCallback(std::unique_ptr new_request); private: - RPCServer& rpc_server; + RPCServer rpc_server; std::unique_ptr udp_server; };