From 386112da3265d111595329508b860800e5cf14e8 Mon Sep 17 00:00:00 2001 From: Subv Date: Thu, 8 Dec 2016 15:01:10 -0500 Subject: Added a framework for partially handling Session disconnections. Further implementation will happen in a future commit. Fixes a regression. --- src/core/hle/kernel/server_session.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/core/hle/kernel/server_session.cpp') diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index f8bccadfd..3fac6b934 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp @@ -11,7 +11,11 @@ namespace Kernel { ServerSession::ServerSession() = default; -ServerSession::~ServerSession() = default; +ServerSession::~ServerSession() { + // This destructor will be called automatically when the last ServerSession handle is closed by the emulated application. + // TODO(Subv): Reduce the ClientPort's connection count, + // if the session is still open, set the connection status to 3 (Closed by server), +} ResultVal> ServerSession::Create(std::string name, std::shared_ptr hle_handler) { SharedPtr server_session(new ServerSession); @@ -49,7 +53,9 @@ ResultCode ServerSession::HandleSyncRequest() { ServerSession::SessionPair ServerSession::CreateSessionPair(const std::string& name, std::shared_ptr hle_handler) { auto server_session = ServerSession::Create(name + "_Server", std::move(hle_handler)).MoveFrom(); - auto client_session = ClientSession::Create(server_session, name + "_Client").MoveFrom(); + // We keep a non-owning pointer to the ServerSession in the ClientSession because we don't want to prevent the + // ServerSession's destructor from being called when the emulated application closes the last ServerSession handle. + auto client_session = ClientSession::Create(server_session.get(), name + "_Client").MoveFrom(); return std::make_tuple(std::move(server_session), std::move(client_session)); } -- cgit v1.2.3