summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_client_port.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/k_client_port.h')
-rw-r--r--src/core/hle/kernel/k_client_port.h46
1 files changed, 25 insertions, 21 deletions
diff --git a/src/core/hle/kernel/k_client_port.h b/src/core/hle/kernel/k_client_port.h
index 60dea4763..43a17f4a4 100644
--- a/src/core/hle/kernel/k_client_port.h
+++ b/src/core/hle/kernel/k_client_port.h
@@ -15,7 +15,7 @@ namespace Kernel {
class KClientSession;
class KernelCore;
-class KServerPort;
+class KPort;
class KClientPort final : public KSynchronizationObject {
KERNEL_AUTOOBJECT_TRAITS(KClientPort, KSynchronizationObject);
@@ -24,30 +24,33 @@ public:
explicit KClientPort(KernelCore& kernel);
virtual ~KClientPort() override;
- friend class KServerPort;
+ void Initialize(KPort* parent_, s32 max_sessions_, std::string&& name_);
+ void OnSessionFinalized();
+ void OnServerClosed();
- void Initialize(s32 max_sessions_, std::string&& name_);
-
- KServerPort* GetServerPort() const;
+ constexpr const KPort* GetParent() const {
+ return parent;
+ }
- /**
- * Creates a new Session pair, adds the created ServerSession to the associated ServerPort's
- * list of pending sessions, and signals the ServerPort, causing any threads
- * waiting on it to awake.
- * @returns ClientSession The client endpoint of the created Session pair, or error code.
- */
- ResultVal<KClientSession*> Connect();
+ s32 GetNumSessions() const {
+ return num_sessions;
+ }
+ s32 GetPeakSessions() const {
+ return peak_sessions;
+ }
+ s32 GetMaxSessions() const {
+ return max_sessions;
+ }
- /**
- * Signifies that a previously active connection has been closed,
- * decreasing the total number of active connections to this port.
- */
- void ConnectionClosed();
+ bool IsLight() const;
+ bool IsServerClosed() const;
// Overridden virtual functions.
virtual void Destroy() override;
virtual bool IsSignaled() const override;
+ ResultCode CreateSession(KClientSession** out);
+
// DEPRECATED
std::string GetTypeName() const override {
@@ -63,10 +66,11 @@ public:
}
private:
- KServerPort* server_port{}; ///< ServerPort associated with this client port.
- s32 max_sessions{}; ///< Maximum number of simultaneous sessions the port can have
- std::atomic<s32> num_sessions{}; ///< Number of currently open sessions to this port
- std::string name; ///< Name of client port (optional)
+ std::atomic<s32> num_sessions{};
+ std::atomic<s32> peak_sessions{};
+ s32 max_sessions{};
+ KPort* parent{};
+ std::string name;
};
} // namespace Kernel