diff options
author | Subv <subv2112@gmail.com> | 2017-01-05 05:23:17 +0100 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2017-05-15 18:22:15 +0200 |
commit | ddfabf31330c0c8e0558a714b6d7e1f1948b73ed (patch) | |
tree | 62c525537f603fe85f494f9fb6e622ffcd2afda9 /src/core/hle/kernel/server_session.cpp | |
parent | Merge pull request #2659 from MerryMage/dsp_dsp-correction (diff) | |
download | yuzu-ddfabf31330c0c8e0558a714b6d7e1f1948b73ed.tar yuzu-ddfabf31330c0c8e0558a714b6d7e1f1948b73ed.tar.gz yuzu-ddfabf31330c0c8e0558a714b6d7e1f1948b73ed.tar.bz2 yuzu-ddfabf31330c0c8e0558a714b6d7e1f1948b73ed.tar.lz yuzu-ddfabf31330c0c8e0558a714b6d7e1f1948b73ed.tar.xz yuzu-ddfabf31330c0c8e0558a714b6d7e1f1948b73ed.tar.zst yuzu-ddfabf31330c0c8e0558a714b6d7e1f1948b73ed.zip |
Diffstat (limited to 'src/core/hle/kernel/server_session.cpp')
-rw-r--r-- | src/core/hle/kernel/server_session.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp index 9447ff236..a93e55c76 100644 --- a/src/core/hle/kernel/server_session.cpp +++ b/src/core/hle/kernel/server_session.cpp @@ -14,8 +14,15 @@ 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), + + // Decrease the port's connection count. + if (parent->port) + parent->port->active_sessions--; + + // TODO(Subv): Wake up all the ClientSession's waiting threads and set + // the SendSyncRequest result to 0xC920181A. + + parent->server = nullptr; } ResultVal<SharedPtr<ServerSession>> ServerSession::Create( @@ -25,6 +32,7 @@ ResultVal<SharedPtr<ServerSession>> ServerSession::Create( server_session->name = std::move(name); server_session->signaled = false; server_session->hle_handler = std::move(hle_handler); + server_session->parent = nullptr; return MakeResult<SharedPtr<ServerSession>>(std::move(server_session)); } @@ -61,13 +69,20 @@ ResultCode ServerSession::HandleSyncRequest() { } ServerSession::SessionPair ServerSession::CreateSessionPair( - const std::string& name, std::shared_ptr<Service::SessionRequestHandler> hle_handler) { + const std::string& name, std::shared_ptr<Service::SessionRequestHandler> hle_handler, + SharedPtr<ClientPort> port) { + auto server_session = ServerSession::Create(name + "_Server", std::move(hle_handler)).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(); + auto client_session = ClientSession::Create(name + "_Client").MoveFrom(); + + std::shared_ptr<Session> parent(new Session); + parent->client = client_session.get(); + parent->server = server_session.get(); + parent->port = port; + + client_session->parent = parent; + server_session->parent = parent; return std::make_tuple(std::move(server_session), std::move(client_session)); } |