[hle/service] Instantly close IPC session when receiving CommandType::Close

This commit is contained in:
smiRaphi 2026-04-07 20:24:07 +02:00
parent c50d4e9820
commit eff026ff8d
No known key found for this signature in database
GPG key ID: 504C55BB79ABECB6
2 changed files with 10 additions and 4 deletions

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@ -381,11 +384,16 @@ Result ServerManager::CompleteSyncRequest(Session* session) {
R_SUCCEED();
}
if (service_res == IPC::ResultSessionClosed) {
this->DestroySession(session);
R_SUCCEED();
}
// Send the reply.
res = server_session->SendReplyHLE();
// If the session has been closed, we're done.
if (res == Kernel::ResultSessionClosed || service_res == IPC::ResultSessionClosed) {
if (res == Kernel::ResultSessionClosed) {
this->DestroySession(session);
R_SUCCEED();
}

View file

@ -105,8 +105,6 @@ Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session,
switch (ctx.GetCommandType()) {
case IPC::CommandType::Close:
case IPC::CommandType::TIPC_Close: {
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
result = IPC::ResultSessionClosed;
break;
}
@ -132,7 +130,7 @@ Result ServiceFrameworkBase::HandleSyncRequest(Kernel::KServerSession& session,
// If emulation was shutdown, we are closing service threads, do not write the response back to
// memory that may be shutting down as well.
if (system.IsPoweredOn()) {
if (system.IsPoweredOn() && result != IPC::ResultSessionClosed) {
ctx.WriteToOutgoingCommandBuffer();
}