[+] ISocketServer::GetSessionCount

This commit is contained in:
Reece Wilson 2023-11-30 02:40:30 +00:00
parent 74b1e560bb
commit 52b49986f3
7 changed files with 27 additions and 0 deletions

View File

@ -12,6 +12,7 @@ namespace Aurora::IO::Net
struct ISocketServer : virtual ISocketBase
{
virtual AuList<AuSPtr<ISocket>> GetChildren() = 0;
virtual AuUInt32 GetSessionCount() = 0;
virtual AuSPtr<ISocketServerLimits> GetLimits() = 0;
virtual AuSPtr<ISocketServerDriver> GetServerDriver() = 0;
};

View File

@ -153,6 +153,11 @@ namespace Aurora::IO::Net
return ret;
}
AuUInt32 SocketServer::GetSessionCount()
{
return this->childrenSockets.size();
}
void SocketServer::OnNotifyChildCreated(SocketBase *pSocket)
{
{

View File

@ -38,6 +38,7 @@ namespace Aurora::IO::Net
AuSPtr<ISocketDriverFactory> GetFactory();
AuSPtr<ISocketServerLimits> GetLimits() override;
AuList<AuSPtr<ISocket>> GetChildren() override;
AuUInt32 GetSessionCount() override;
virtual void FinishConstructAsync() override;

View File

@ -88,4 +88,17 @@ namespace Aurora::IO::Net
return {};
}
}
AuUInt32 NetDatagramEmulatorISocketServer::GetSessionCount()
{
if (auto pParent = this->pParent)
{
return pParent->GetSessionCount();
}
else
{
return {};
}
}
}

View File

@ -31,5 +31,6 @@ namespace Aurora::IO::Net
AuSPtr<ISocketServerLimits> GetLimits() override;
AuList<AuSPtr<ISocket>> GetChildren() override;
AuSPtr<INetWorker> GetLockedWorkerThread() override;
AuUInt32 GetSessionCount() override;
};
}

View File

@ -226,6 +226,11 @@ namespace Aurora::IO::Net
return ret;
}
AuUInt32 NetDatagramSocketServer::GetSessionCount()
{
return this->sessions.size();
}
AuSPtr<INetWorker> NetDatagramSocketServer::GetLockedWorkerThread()
{
if (auto pWorker = this->pWorker_)

View File

@ -39,6 +39,7 @@ namespace Aurora::IO::Net
void Cleanup(const AuSPtr<NetDatagramSocketServerSession> &pSession);
AuList<AuSPtr<NetDatagramSocketServerSession>> GetAllSessions();
AuList<AuSPtr<ISocket>> GetAllChildren();
AuUInt32 GetSessionCount();
AuSPtr<NetDatagramSocketServerDriver> ToDriver();
AuSPtr<ISocketServer> ToSocketServer();