diff options
author | bunnei <bunneidev@gmail.com> | 2021-06-10 07:53:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-10 07:53:25 +0200 |
commit | 74f0087bfa673a530d88231b64c73acc3861fce9 (patch) | |
tree | 2e810f84e6d0f3ae62444ee3ba62cb91a48e5cfd /src/core/hle/kernel | |
parent | Merge pull request #6439 from lat9nq/ci-no-7z (diff) | |
parent | hle: kernel: KClientPort: Add an assert for session count. (diff) | |
download | yuzu-74f0087bfa673a530d88231b64c73acc3861fce9.tar yuzu-74f0087bfa673a530d88231b64c73acc3861fce9.tar.gz yuzu-74f0087bfa673a530d88231b64c73acc3861fce9.tar.bz2 yuzu-74f0087bfa673a530d88231b64c73acc3861fce9.tar.lz yuzu-74f0087bfa673a530d88231b64c73acc3861fce9.tar.xz yuzu-74f0087bfa673a530d88231b64c73acc3861fce9.tar.zst yuzu-74f0087bfa673a530d88231b64c73acc3861fce9.zip |
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r-- | src/core/hle/kernel/hle_ipc.cpp | 4 | ||||
-rw-r--r-- | src/core/hle/kernel/k_client_port.cpp | 5 | ||||
-rw-r--r-- | src/core/hle/kernel/k_server_session.h | 11 |
3 files changed, 11 insertions, 9 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index 45aced99f..28ed6265a 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp @@ -57,11 +57,11 @@ bool SessionRequestManager::HasSessionRequestHandler(const HLERequestContext& co } void SessionRequestHandler::ClientConnected(KServerSession* session) { - session->SetSessionHandler(shared_from_this()); + session->ClientConnected(shared_from_this()); } void SessionRequestHandler::ClientDisconnected(KServerSession* session) { - session->SetSessionHandler(nullptr); + session->ClientDisconnected(); } HLERequestContext::HLERequestContext(KernelCore& kernel_, Core::Memory::Memory& memory_, diff --git a/src/core/hle/kernel/k_client_port.cpp b/src/core/hle/kernel/k_client_port.cpp index 50606bd91..ef168fe87 100644 --- a/src/core/hle/kernel/k_client_port.cpp +++ b/src/core/hle/kernel/k_client_port.cpp @@ -28,6 +28,9 @@ void KClientPort::Initialize(KPort* parent_port_, s32 max_sessions_, std::string void KClientPort::OnSessionFinalized() { KScopedSchedulerLock sl{kernel}; + // This might happen if a session was improperly used with this port. + ASSERT_MSG(num_sessions > 0, "num_sessions is invalid"); + const auto prev = num_sessions--; if (prev == max_sessions) { this->NotifyAvailable(); @@ -66,7 +69,7 @@ ResultCode KClientPort::CreateSession(KClientSession** out, // Update the session counts. { // Atomically increment the number of sessions. - s32 new_sessions; + s32 new_sessions{}; { const auto max = max_sessions; auto cur_sessions = num_sessions.load(std::memory_order_acquire); diff --git a/src/core/hle/kernel/k_server_session.h b/src/core/hle/kernel/k_server_session.h index 9efd400bc..d44bc9d4f 100644 --- a/src/core/hle/kernel/k_server_session.h +++ b/src/core/hle/kernel/k_server_session.h @@ -62,15 +62,14 @@ public: void OnClientClosed(); - /** - * Sets the HLE handler for the session. This handler will be called to service IPC requests - * instead of the regular IPC machinery. (The regular IPC machinery is currently not - * implemented.) - */ - void SetSessionHandler(SessionRequestHandlerPtr handler) { + void ClientConnected(SessionRequestHandlerPtr handler) { manager->SetSessionHandler(std::move(handler)); } + void ClientDisconnected() { + manager = nullptr; + } + /** * Handle a sync request from the emulated application. * |