summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-06-10 21:17:13 +0200
committerGitHub <noreply@github.com>2021-06-10 21:17:13 +0200
commit4547b2735a7e663be436bca54ed83da06a109c86 (patch)
treecb1c3905b5cbcc47aa31100e4bc484bb79252213
parenthle: service: Increase arbitrary max sessions limit. (diff)
parenthle: service: sm: Remove redundant session reservation, etc. (diff)
downloadyuzu-4547b2735a7e663be436bca54ed83da06a109c86.tar
yuzu-4547b2735a7e663be436bca54ed83da06a109c86.tar.gz
yuzu-4547b2735a7e663be436bca54ed83da06a109c86.tar.bz2
yuzu-4547b2735a7e663be436bca54ed83da06a109c86.tar.lz
yuzu-4547b2735a7e663be436bca54ed83da06a109c86.tar.xz
yuzu-4547b2735a7e663be436bca54ed83da06a109c86.tar.zst
yuzu-4547b2735a7e663be436bca54ed83da06a109c86.zip
-rw-r--r--src/core/hle/service/service.h5
-rw-r--r--src/core/hle/service/sm/sm.cpp26
2 files changed, 13 insertions, 18 deletions
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 6c5bf3a95..e078ac176 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -41,7 +41,10 @@ class ServiceManager;
}
/// Default number of maximum connections to a server session.
-static constexpr u32 ServerSessionCountMax = 0x10000;
+static constexpr u32 ServerSessionCountMax = 0x40;
+static_assert(ServerSessionCountMax == 0x40,
+ "ServerSessionCountMax isn't 0x40 somehow, this assert is a reminder that this will "
+ "break lots of things");
/**
* This is an non-templated base of ServiceFramework to reduce code bloat and compilation times, it
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp
index a1e1a7d76..c7828c3bd 100644
--- a/src/core/hle/service/sm/sm.cpp
+++ b/src/core/hle/service/sm/sm.cpp
@@ -151,27 +151,19 @@ ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(Kernel::HLERequestContext&
std::string name(PopServiceName(rp));
// Find the named port.
- auto result = service_manager.GetServicePort(name);
- if (result.Failed()) {
- LOG_ERROR(Service_SM, "called service={} -> error 0x{:08X}", name, result.Code().raw);
- return result.Code();
+ auto port_result = service_manager.GetServicePort(name);
+ if (port_result.Failed()) {
+ LOG_ERROR(Service_SM, "called service={} -> error 0x{:08X}", name, port_result.Code().raw);
+ return port_result.Code();
}
- auto* port = result.Unwrap();
-
- // Reserve a new session from the process resource limit.
- Kernel::KScopedResourceReservation session_reservation(
- kernel.CurrentProcess()->GetResourceLimit(), Kernel::LimitableResource::Sessions);
- R_UNLESS(session_reservation.Succeeded(), Kernel::ResultLimitReached);
+ auto& port = port_result.Unwrap()->GetClientPort();
// Create a new session.
Kernel::KClientSession* session{};
- port->GetClientPort().CreateSession(std::addressof(session));
-
- // Commit the session reservation.
- session_reservation.Commit();
-
- // Enqueue the session with the named port.
- port->EnqueueSession(&session->GetParent()->GetServerSession());
+ if (const auto result = port.CreateSession(std::addressof(session)); result.IsError()) {
+ LOG_ERROR(Service_SM, "called service={} -> error 0x{:08X}", name, result.raw);
+ return result;
+ }
LOG_DEBUG(Service_SM, "called service={} -> session={}", name, session->GetId());