summaryrefslogtreecommitdiff
path: root/src/core/hle/svc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/svc.cpp')
-rw-r--r--src/core/hle/svc.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index ab0eb9d86..4189d75ac 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -224,18 +224,10 @@ static ResultCode ConnectToPort(Handle* out_handle, const char* port_name) {
224 return ERR_NOT_FOUND; 224 return ERR_NOT_FOUND;
225 } 225 }
226 226
227 auto client_port = std::get<Kernel::SharedPtr<Kernel::ClientPort>>(it->second); 227 auto client_port = it->second;
228 // The hle_handler will be nullptr if this port was registered by the emulated
229 // application by means of svcCreatePort with a defined name.
230 auto hle_handler = std::get<std::shared_ptr<Service::Interface>>(it->second);
231 228
232 // Create a new session pair 229 // Connect to the port and retrieve the client endpoint of the connection Session.
233 auto sessions = Kernel::ServerSession::CreateSessionPair(port_name, hle_handler); 230 auto client_session = client_port->Connect();
234 auto client_session = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions);
235 auto server_session = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions);
236
237 // Add the server session to the port's queue
238 client_port->AddWaitingSession(server_session);
239 231
240 // Note: Threads do not wait for the server endpoint to call 232 // Note: Threads do not wait for the server endpoint to call
241 // AcceptSession before returning from this call. 233 // AcceptSession before returning from this call.
@@ -254,8 +246,8 @@ static ResultCode SendSyncRequest(Handle handle) {
254 246
255 LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s)", handle, session->GetName().c_str()); 247 LOG_TRACE(Kernel_SVC, "called handle=0x%08X(%s)", handle, session->GetName().c_str());
256 248
257 // TODO(Subv): Wait the current thread and reschedule if this request is not going to be handled by HLE code. 249 // TODO(Subv): svcSendSyncRequest should put the caller thread to sleep while the server responds and cause a reschedule.
258 return session->HandleSyncRequest(); 250 return session->SendSyncRequest();
259} 251}
260 252
261/// Close a handle 253/// Close a handle