hle: service: sm: Fix GetService setup of session & port.
This commit is contained in:
parent
2aa6a8d889
commit
ec5674a6ad
|
@ -66,7 +66,7 @@ ResultCode KClientPort::CreateSession(KClientSession** out,
|
||||||
// Update the session counts.
|
// Update the session counts.
|
||||||
{
|
{
|
||||||
// Atomically increment the number of sessions.
|
// Atomically increment the number of sessions.
|
||||||
s32 new_sessions;
|
s32 new_sessions{};
|
||||||
{
|
{
|
||||||
const auto max = max_sessions;
|
const auto max = max_sessions;
|
||||||
auto cur_sessions = num_sessions.load(std::memory_order_acquire);
|
auto cur_sessions = num_sessions.load(std::memory_order_acquire);
|
||||||
|
|
|
@ -164,18 +164,18 @@ ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(Kernel::HLERequestContext&
|
||||||
R_UNLESS(session_reservation.Succeeded(), Kernel::ResultLimitReached);
|
R_UNLESS(session_reservation.Succeeded(), Kernel::ResultLimitReached);
|
||||||
|
|
||||||
// Create a new session.
|
// Create a new session.
|
||||||
auto* session = Kernel::KSession::Create(kernel);
|
Kernel::KClientSession* session{};
|
||||||
session->Initialize(&port->GetClientPort(), std::move(name));
|
port->GetClientPort().CreateSession(std::addressof(session));
|
||||||
|
|
||||||
// Commit the session reservation.
|
// Commit the session reservation.
|
||||||
session_reservation.Commit();
|
session_reservation.Commit();
|
||||||
|
|
||||||
// Enqueue the session with the named port.
|
// Enqueue the session with the named port.
|
||||||
port->EnqueueSession(&session->GetServerSession());
|
port->EnqueueSession(&session->GetParent()->GetServerSession());
|
||||||
|
|
||||||
LOG_DEBUG(Service_SM, "called service={} -> session={}", name, session->GetId());
|
LOG_DEBUG(Service_SM, "called service={} -> session={}", name, session->GetId());
|
||||||
|
|
||||||
return MakeResult(&session->GetClientSession());
|
return MakeResult(session);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SM::RegisterService(Kernel::HLERequestContext& ctx) {
|
void SM::RegisterService(Kernel::HLERequestContext& ctx) {
|
||||||
|
|
Loading…
Reference in New Issue