mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-17 15:37:33 +01:00
hle: service: sm: GetService: Reserve session resource when we create a KSession.
This commit is contained in:
parent
21671d05a3
commit
49c4c329f6
@ -133,9 +133,16 @@ void SM::GetService(Kernel::HLERequestContext& ctx) {
|
|||||||
|
|
||||||
auto* port = result.Unwrap();
|
auto* port = result.Unwrap();
|
||||||
|
|
||||||
|
Kernel::KScopedResourceReservation session_reservation(
|
||||||
|
kernel.CurrentProcess()->GetResourceLimit(), Kernel::LimitableResource::Sessions);
|
||||||
|
R_UNLESS(session_reservation.Succeeded(), Kernel::ResultLimitReached);
|
||||||
|
|
||||||
auto* session = Kernel::KSession::Create(kernel);
|
auto* session = Kernel::KSession::Create(kernel);
|
||||||
session->Initialize(&port->GetClientPort(), std::move(name));
|
session->Initialize(&port->GetClientPort(), std::move(name));
|
||||||
|
|
||||||
|
// Commit the session reservation.
|
||||||
|
session_reservation.Commit();
|
||||||
|
|
||||||
if (port->GetServerPort().GetHLEHandler()) {
|
if (port->GetServerPort().GetHLEHandler()) {
|
||||||
port->GetServerPort().GetHLEHandler()->ClientConnected(&session->GetServerSession());
|
port->GetServerPort().GetHLEHandler()->ClientConnected(&session->GetServerSession());
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user