mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user