Core/Network: Refactor AsyncAcceptor to use async_accept overload producing sockets through argument instead of having to preallocate it

* Also improve main() cleanup to fully process all queued async operations (including their cancellations)
This commit is contained in:
Shauren
2026-01-12 20:59:19 +01:00
parent c2c5c70fb1
commit 585e170ad6
17 changed files with 187 additions and 190 deletions

View File

@@ -17,23 +17,6 @@
#include "SessionManager.h"
bool Battlenet::SessionManager::StartNetwork(Trinity::Asio::IoContext& ioContext, std::string const& bindIp, uint16 port, int threadCount)
{
if (!BaseSocketMgr::StartNetwork(ioContext, bindIp, port, threadCount))
return false;
_acceptor->AsyncAccept([this](Trinity::Net::IoContextTcpSocket&& sock, uint32 threadIndex)
{
OnSocketOpen(std::move(sock), threadIndex);
});
return true;
}
Battlenet::SessionNetworkThread* Battlenet::SessionManager::CreateThreads() const
{
return new SessionNetworkThread[GetNetworkThreadCount()];
}
Battlenet::SessionManager& Battlenet::SessionManager::Instance()
{
static SessionManager instance;