diff options
author | Subv <subv2112@gmail.com> | 2016-12-08 21:01:10 +0100 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2016-12-08 21:01:10 +0100 |
commit | 386112da3265d111595329508b860800e5cf14e8 (patch) | |
tree | 7cb27e289abd255ff7f371eff0f9d1ddd07b5d11 /src/core/hle/kernel/server_session.cpp | |
parent | Use std::move where appropriate. (diff) | |
download | yuzu-386112da3265d111595329508b860800e5cf14e8.tar yuzu-386112da3265d111595329508b860800e5cf14e8.tar.gz yuzu-386112da3265d111595329508b860800e5cf14e8.tar.bz2 yuzu-386112da3265d111595329508b860800e5cf14e8.tar.lz yuzu-386112da3265d111595329508b860800e5cf14e8.tar.xz yuzu-386112da3265d111595329508b860800e5cf14e8.tar.zst yuzu-386112da3265d111595329508b860800e5cf14e8.zip |
Diffstat (limited to 'src/core/hle/kernel/server_session.cpp')
-rw-r--r-- | src/core/hle/kernel/server_session.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
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<SharedPtr<ServerSession>> ServerSession::Create(std::string name, std::shared_ptr<Service::SessionRequestHandler> hle_handler) { SharedPtr<ServerSession> server_session(new ServerSession); @@ -49,7 +53,9 @@ ResultCode ServerSession::HandleSyncRequest() { ServerSession::SessionPair ServerSession::CreateSessionPair(const std::string& name, std::shared_ptr<Service::SessionRequestHandler> 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)); } |