summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-06-10 07:53:25 +0200
committerGitHub <noreply@github.com>2021-06-10 07:53:25 +0200
commit74f0087bfa673a530d88231b64c73acc3861fce9 (patch)
tree2e810f84e6d0f3ae62444ee3ba62cb91a48e5cfd /src/core/hle/service
parentMerge pull request #6439 from lat9nq/ci-no-7z (diff)
parenthle: kernel: KClientPort: Add an assert for session count. (diff)
downloadyuzu-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 '')
-rw-r--r--src/core/hle/service/service.h10
-rw-r--r--src/core/hle/service/sm/sm.cpp8
2 files changed, 10 insertions, 8 deletions
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 7f133a7cb..e078ac176 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -40,9 +40,11 @@ namespace SM {
class ServiceManager;
}
-static const int kMaxPortSize = 8; ///< Maximum size of a port name (8 characters)
-/// Arbitrary default number of maximum connections to an HLE service.
-static const u32 DefaultMaxSessions = 0x10000;
+/// Default number of maximum connections to a server session.
+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
@@ -178,7 +180,7 @@ protected:
* connected to this service at the same time.
*/
explicit ServiceFramework(Core::System& system_, const char* service_name_,
- u32 max_sessions_ = DefaultMaxSessions)
+ u32 max_sessions_ = ServerSessionCountMax)
: ServiceFrameworkBase(system_, service_name_, max_sessions_, Invoker) {}
/// Registers handlers in the service.
diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp
index bffa9ffcb..a1e1a7d76 100644
--- a/src/core/hle/service/sm/sm.cpp
+++ b/src/core/hle/service/sm/sm.cpp
@@ -164,18 +164,18 @@ ResultVal<Kernel::KClientSession*> SM::GetServiceImpl(Kernel::HLERequestContext&
R_UNLESS(session_reservation.Succeeded(), Kernel::ResultLimitReached);
// Create a new session.
- auto* session = Kernel::KSession::Create(kernel);
- session->Initialize(&port->GetClientPort(), std::move(name));
+ 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->GetServerSession());
+ port->EnqueueSession(&session->GetParent()->GetServerSession());
LOG_DEBUG(Service_SM, "called service={} -> session={}", name, session->GetId());
- return MakeResult(&session->GetClientSession());
+ return MakeResult(session);
}
void SM::RegisterService(Kernel::HLERequestContext& ctx) {