summaryrefslogtreecommitdiff
path: root/src/core/hle/service/srv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/service/srv.cpp')
-rw-r--r--src/core/hle/service/srv.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp
index b25be413a..eb2e06041 100644
--- a/src/core/hle/service/srv.cpp
+++ b/src/core/hle/service/srv.cpp
@@ -2,8 +2,12 @@
2// Licensed under GPLv2 or any later version 2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <tuple>
6
5#include "common/common_types.h" 7#include "common/common_types.h"
6#include "common/logging/log.h" 8#include "common/logging/log.h"
9#include "core/hle/service/srv.h"
10#include "core/hle/kernel/client_session.h"
7#include "core/hle/kernel/event.h" 11#include "core/hle/kernel/event.h"
8#include "core/hle/service/srv.h" 12#include "core/hle/service/srv.h"
9 13
@@ -81,7 +85,18 @@ static void GetServiceHandle(Service::Interface* self) {
81 auto it = Service::g_srv_services.find(port_name); 85 auto it = Service::g_srv_services.find(port_name);
82 86
83 if (it != Service::g_srv_services.end()) { 87 if (it != Service::g_srv_services.end()) {
84 cmd_buff[3] = Kernel::g_handle_table.Create(it->second).MoveFrom(); 88 auto client_port = it->second;
89
90 // Create a new session pair
91 auto sessions = Kernel::ServerSession::CreateSessionPair(client_port, port_name);
92 auto client_session = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions);
93 auto server_session = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions);
94
95 // Add the server session to the port's queue
96 client_port->AddWaitingSession(server_session);
97
98 // Return the client session
99 cmd_buff[3] = Kernel::g_handle_table.Create(client_session).MoveFrom();
85 LOG_TRACE(Service_SRV, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]); 100 LOG_TRACE(Service_SRV, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]);
86 } else { 101 } else {
87 LOG_ERROR(Service_SRV, "(UNIMPLEMENTED) called port=%s", port_name.c_str()); 102 LOG_ERROR(Service_SRV, "(UNIMPLEMENTED) called port=%s", port_name.c_str());