summaryrefslogtreecommitdiff
path: root/src/core/hle/service/service.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/service.cpp')
-rw-r--r--src/core/hle/service/service.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 5db6588e4..0913a8065 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -99,6 +99,10 @@ ServiceFrameworkBase::ServiceFrameworkBase(Core::System& system_, const char* se
99ServiceFrameworkBase::~ServiceFrameworkBase() { 99ServiceFrameworkBase::~ServiceFrameworkBase() {
100 // Wait for other threads to release access before destroying 100 // Wait for other threads to release access before destroying
101 const auto guard = LockService(); 101 const auto guard = LockService();
102
103 if (named_port != nullptr) {
104 named_port->Close();
105 }
102} 106}
103 107
104void ServiceFrameworkBase::InstallAsService(SM::ServiceManager& service_manager) { 108void ServiceFrameworkBase::InstallAsService(SM::ServiceManager& service_manager) {
@@ -115,13 +119,12 @@ Kernel::KClientPort& ServiceFrameworkBase::CreatePort() {
115 119
116 ASSERT(!service_registered); 120 ASSERT(!service_registered);
117 121
118 auto* port = Kernel::KPort::Create(kernel); 122 named_port = Kernel::KPort::Create(kernel);
119 port->Initialize(max_sessions, false, service_name); 123 named_port->Initialize(max_sessions, false, service_name);
120 port->GetServerPort().SetSessionHandler(shared_from_this());
121 124
122 service_registered = true; 125 service_registered = true;
123 126
124 return port->GetClientPort(); 127 return named_port->GetClientPort();
125} 128}
126 129
127void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n) { 130void ServiceFrameworkBase::RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n) {
@@ -199,7 +202,6 @@ Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session,
199 switch (ctx.GetCommandType()) { 202 switch (ctx.GetCommandType()) {
200 case IPC::CommandType::Close: 203 case IPC::CommandType::Close:
201 case IPC::CommandType::TIPC_Close: { 204 case IPC::CommandType::TIPC_Close: {
202 session.Close();
203 IPC::ResponseBuilder rb{ctx, 2}; 205 IPC::ResponseBuilder rb{ctx, 2};
204 rb.Push(ResultSuccess); 206 rb.Push(ResultSuccess);
205 result = IPC::ERR_REMOTE_PROCESS_DEAD; 207 result = IPC::ERR_REMOTE_PROCESS_DEAD;
@@ -244,6 +246,7 @@ Services::Services(std::shared_ptr<SM::ServiceManager>& sm, Core::System& system
244 system.GetFileSystemController().CreateFactories(*system.GetFilesystem(), false); 246 system.GetFileSystemController().CreateFactories(*system.GetFilesystem(), false);
245 247
246 system.Kernel().RegisterNamedService("sm:", SM::ServiceManager::InterfaceFactory); 248 system.Kernel().RegisterNamedService("sm:", SM::ServiceManager::InterfaceFactory);
249 system.Kernel().RegisterInterfaceForNamedService("sm:", SM::ServiceManager::SessionHandler);
247 250
248 Account::InstallInterfaces(system); 251 Account::InstallInterfaces(system);
249 AM::InstallInterfaces(*sm, *nv_flinger, system); 252 AM::InstallInterfaces(*sm, *nv_flinger, system);