summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/srv.cpp
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2016-06-15 01:03:30 +0200
committerSubv <subv2112@gmail.com>2016-12-01 05:02:05 +0100
commit073653e858abf377fd1ebbdb071809c8830ce99d (patch)
treea29e1c1e50d53162ed89cd90e8c069525150392f /src/core/hle/service/srv.cpp
parentMerge pull request #2228 from freiro/winver_fix (diff)
downloadyuzu-073653e858abf377fd1ebbdb071809c8830ce99d.tar
yuzu-073653e858abf377fd1ebbdb071809c8830ce99d.tar.gz
yuzu-073653e858abf377fd1ebbdb071809c8830ce99d.tar.bz2
yuzu-073653e858abf377fd1ebbdb071809c8830ce99d.tar.lz
yuzu-073653e858abf377fd1ebbdb071809c8830ce99d.tar.xz
yuzu-073653e858abf377fd1ebbdb071809c8830ce99d.tar.zst
yuzu-073653e858abf377fd1ebbdb071809c8830ce99d.zip
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 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include <tuple>
+
#include "common/common_types.h"
#include "common/logging/log.h"
+#include "core/hle/service/srv.h"
+#include "core/hle/kernel/client_session.h"
#include "core/hle/kernel/event.h"
#include "core/hle/service/srv.h"
@@ -81,7 +85,18 @@ static void GetServiceHandle(Service::Interface* self) {
auto it = Service::g_srv_services.find(port_name);
if (it != Service::g_srv_services.end()) {
- cmd_buff[3] = Kernel::g_handle_table.Create(it->second).MoveFrom();
+ auto client_port = it->second;
+
+ // Create a new session pair
+ auto sessions = Kernel::ServerSession::CreateSessionPair(client_port, port_name);
+ auto client_session = std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions);
+ auto server_session = std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions);
+
+ // Add the server session to the port's queue
+ client_port->AddWaitingSession(server_session);
+
+ // Return the client session
+ cmd_buff[3] = Kernel::g_handle_table.Create(client_session).MoveFrom();
LOG_TRACE(Service_SRV, "called port=%s, handle=0x%08X", port_name.c_str(), cmd_buff[3]);
} else {
LOG_ERROR(Service_SRV, "(UNIMPLEMENTED) called port=%s", port_name.c_str());