summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/service.h
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2016-06-15 01:03:30 +0200
committerSubv <subv2112@gmail.com>2016-12-01 05:02:05 +0100
commit073653e858abf377fd1ebbdb071809c8830ce99d (patch)
treea29e1c1e50d53162ed89cd90e8c069525150392f /src/core/hle/service/service.h
parentMerge pull request #2228 from freiro/winver_fix (diff)
downloadyuzu-073653e858abf377fd1ebbdb071809c8830ce99d.tar
yuzu-073653e858abf377fd1ebbdb071809c8830ce99d.tar.gz
yuzu-073653e858abf377fd1ebbdb071809c8830ce99d.tar.bz2
yuzu-073653e858abf377fd1ebbdb071809c8830ce99d.tar.lz
yuzu-073653e858abf377fd1ebbdb071809c8830ce99d.tar.xz
yuzu-073653e858abf377fd1ebbdb071809c8830ce99d.tar.zst
yuzu-073653e858abf377fd1ebbdb071809c8830ce99d.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/service.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 29daacfc4..fd15ad03f 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -9,7 +9,8 @@
#include <unordered_map>
#include <boost/container/flat_map.hpp>
#include "common/common_types.h"
-#include "core/hle/kernel/session.h"
+#include "core/hle/kernel/client_port.h"
+#include "core/hle/kernel/server_session.h"
#include "core/hle/result.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -18,9 +19,10 @@
namespace Service {
static const int kMaxPortSize = 8; ///< Maximum size of a port name (8 characters)
+static const u32 DefaultMaxSessions = 10; ///< Arbitrary default number of maximum connections to an HLE port
/// Interface to a CTROS service
-class Interface : public Kernel::Session {
+class Interface : public Kernel::ClientPort {
// TODO(yuriks): An "Interface" being a Kernel::Object is mostly non-sense. Interface should be
// just something that encapsulates a session and acts as a helper to implement service
// processes.
@@ -33,6 +35,15 @@ public:
version.raw = raw_version;
}
+ /**
+ * Gets the maximum allowed number of sessions that can be connected to this port at the same time.
+ * It should be overwritten by each service implementation for more fine-grained control.
+ * @returns The maximum number of connections allowed.
+ */
+ virtual u32 GetMaxSessions() { return DefaultMaxSessions; }
+
+ void AddWaitingSession(Kernel::SharedPtr<Kernel::ServerSession> server_session) override { }
+
typedef void (*Function)(Interface*);
struct FunctionInfo {
@@ -49,7 +60,7 @@ public:
return "[UNKNOWN SERVICE PORT]";
}
- ResultVal<bool> SyncRequest() override;
+ ResultCode HandleSyncRequest() override;
protected:
/**
@@ -81,9 +92,9 @@ void Init();
void Shutdown();
/// Map of named ports managed by the kernel, which can be retrieved using the ConnectToPort SVC.
-extern std::unordered_map<std::string, Kernel::SharedPtr<Interface>> g_kernel_named_ports;
+extern std::unordered_map<std::string, Kernel::SharedPtr<Kernel::ClientPort>> g_kernel_named_ports;
/// Map of services registered with the "srv:" service, retrieved using GetServiceHandle.
-extern std::unordered_map<std::string, Kernel::SharedPtr<Interface>> g_srv_services;
+extern std::unordered_map<std::string, Kernel::SharedPtr<Kernel::ClientPort>> g_srv_services;
/// Adds a service to the services table
void AddService(Interface* interface_);