Core/Networking: Fixed authserver socket read handlers being called on incorrect thread

(cherry picked from commit 3ad05386c8)
This commit is contained in:
Shauren
2020-07-28 19:44:38 +02:00
parent f220e46c50
commit d2cde75ab2
2 changed files with 4 additions and 2 deletions

View File

@@ -92,13 +92,13 @@ bool WorldSocketMgr::StartWorldNetwork(Trinity::Asio::IoContext& ioContext, std:
if (!instanceAcceptor->Bind())
{
TC_LOG_ERROR("network", "StartNetwork failed to bind instance socket acceptor");
delete instanceAcceptor;
return false;
}
_instanceAcceptor = instanceAcceptor;
_acceptor->SetSocketFactory(std::bind(&BaseSocketMgr::GetSocketForAccept, this));
_instanceAcceptor->SetSocketFactory(std::bind(&BaseSocketMgr::GetSocketForAccept, this));
_instanceAcceptor->SetSocketFactory([this]() { return GetSocketForAccept(); });
_acceptor->AsyncAcceptWithCallback<&OnSocketAccept>();
_instanceAcceptor->AsyncAcceptWithCallback<&OnSocketAccept>();

View File

@@ -66,6 +66,8 @@ public:
for (int32 i = 0; i < _threadCount; ++i)
_threads[i].Start();
_acceptor->SetSocketFactory([this]() { return GetSocketForAccept(); });
return true;
}