diff options
Diffstat (limited to 'src/core/hle/service/sm')
-rw-r--r-- | src/core/hle/service/sm/sm.cpp | 6 | ||||
-rw-r--r-- | src/core/hle/service/sm/sm.h | 7 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index e0cde9a05..f2cdefa1c 100644 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -51,7 +51,7 @@ static Result ValidateServiceName(const std::string& name) { } Result ServiceManager::RegisterService(std::string name, u32 max_sessions, - SessionRequestHandlerPtr handler) { + SessionRequestHandlerFactory handler) { R_TRY(ValidateServiceName(name)); std::scoped_lock lk{lock}; @@ -262,7 +262,9 @@ void LoopProcess(Core::System& system) { server_manager->ManageDeferral(&deferral_event); service_manager.SetDeferralEvent(deferral_event); - server_manager->ManageNamedPort("sm:", std::make_shared<SM>(system.ServiceManager(), system)); + auto sm_service = std::make_shared<SM>(system.ServiceManager(), system); + server_manager->ManageNamedPort("sm:", [sm_service] { return sm_service; }); + ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/sm/sm.h b/src/core/hle/service/sm/sm.h index 14bfaf8c2..cf102c339 100644 --- a/src/core/hle/service/sm/sm.h +++ b/src/core/hle/service/sm/sm.h @@ -53,7 +53,8 @@ public: explicit ServiceManager(Kernel::KernelCore& kernel_); ~ServiceManager(); - Result RegisterService(std::string name, u32 max_sessions, SessionRequestHandlerPtr handler); + Result RegisterService(std::string name, u32 max_sessions, + SessionRequestHandlerFactory handler_factory); Result UnregisterService(const std::string& name); Result GetServicePort(Kernel::KPort** out_port, const std::string& name); @@ -64,7 +65,7 @@ public: LOG_DEBUG(Service, "Can't find service: {}", service_name); return nullptr; } - return std::static_pointer_cast<T>(service->second); + return std::static_pointer_cast<T>(service->second()); } void InvokeControlRequest(HLERequestContext& context); @@ -79,7 +80,7 @@ private: /// Map of registered services, retrieved using GetServicePort. std::mutex lock; - std::unordered_map<std::string, SessionRequestHandlerPtr> registered_services; + std::unordered_map<std::string, SessionRequestHandlerFactory> registered_services; std::unordered_map<std::string, Kernel::KPort*> service_ports; /// Kernel context |