mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
Merge pull request #949 from lioncash/priv
client_port: Make all data members private
This commit is contained in:
commit
8f73f41824
3 changed files with 21 additions and 7 deletions
|
@ -14,8 +14,8 @@
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
ClientPort::ClientPort() {}
|
ClientPort::ClientPort() = default;
|
||||||
ClientPort::~ClientPort() {}
|
ClientPort::~ClientPort() = default;
|
||||||
|
|
||||||
ResultVal<SharedPtr<ClientSession>> ClientPort::Connect() {
|
ResultVal<SharedPtr<ClientSession>> ClientPort::Connect() {
|
||||||
// Note: Threads do not wait for the server endpoint to call
|
// Note: Threads do not wait for the server endpoint to call
|
||||||
|
@ -40,4 +40,12 @@ ResultVal<SharedPtr<ClientSession>> ClientPort::Connect() {
|
||||||
return MakeResult(std::get<SharedPtr<ClientSession>>(sessions));
|
return MakeResult(std::get<SharedPtr<ClientSession>>(sessions));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientPort::ConnectionClosed() {
|
||||||
|
if (active_sessions == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
--active_sessions;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
|
@ -37,14 +37,20 @@ public:
|
||||||
*/
|
*/
|
||||||
ResultVal<SharedPtr<ClientSession>> Connect();
|
ResultVal<SharedPtr<ClientSession>> Connect();
|
||||||
|
|
||||||
SharedPtr<ServerPort> server_port; ///< ServerPort associated with this client port.
|
/**
|
||||||
u32 max_sessions; ///< Maximum number of simultaneous sessions the port can have
|
* Signifies that a previously active connection has been closed,
|
||||||
u32 active_sessions; ///< Number of currently open sessions to this port
|
* decreasing the total number of active connections to this port.
|
||||||
std::string name; ///< Name of client port (optional)
|
*/
|
||||||
|
void ConnectionClosed();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ClientPort();
|
ClientPort();
|
||||||
~ClientPort() override;
|
~ClientPort() override;
|
||||||
|
|
||||||
|
SharedPtr<ServerPort> server_port; ///< ServerPort associated with this client port.
|
||||||
|
u32 max_sessions = 0; ///< Maximum number of simultaneous sessions the port can have
|
||||||
|
u32 active_sessions = 0; ///< Number of currently open sessions to this port
|
||||||
|
std::string name; ///< Name of client port (optional)
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
|
@ -27,7 +27,7 @@ ServerSession::~ServerSession() {
|
||||||
|
|
||||||
// Decrease the port's connection count.
|
// Decrease the port's connection count.
|
||||||
if (parent->port)
|
if (parent->port)
|
||||||
parent->port->active_sessions--;
|
parent->port->ConnectionClosed();
|
||||||
|
|
||||||
// TODO(Subv): Wake up all the ClientSession's waiting threads and set
|
// TODO(Subv): Wake up all the ClientSession's waiting threads and set
|
||||||
// the SendSyncRequest result to 0xC920181A.
|
// the SendSyncRequest result to 0xC920181A.
|
||||||
|
|
Loading…
Reference in a new issue