mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Networking: Fixed Socket::DelayedCloseSocket not working if write queue is empty when its called on linux and mac
Closes #29887
This commit is contained in:
@@ -724,6 +724,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
|
||||
// Check that Key and account name are the same on client and server
|
||||
if (memcmp(hmac.GetDigest().data(), authSession->Digest.data(), authSession->Digest.size()) != 0)
|
||||
{
|
||||
SendAuthResponseError(ERROR_DENIED);
|
||||
TC_LOG_ERROR("network", "WorldSocket::HandleAuthSession: Authentication failed for account: {} ('{}') address: {}", account.Game.Id, authSession->RealmJoinTicket, address);
|
||||
DelayedCloseSocket();
|
||||
return;
|
||||
|
||||
@@ -164,7 +164,14 @@ public:
|
||||
}
|
||||
|
||||
/// Marks the socket for closing after write buffer becomes empty
|
||||
void DelayedCloseSocket() { _closing = true; }
|
||||
void DelayedCloseSocket()
|
||||
{
|
||||
if (_closing.exchange(true))
|
||||
return;
|
||||
|
||||
if (_writeQueue.empty())
|
||||
CloseSocket();
|
||||
}
|
||||
|
||||
MessageBuffer& GetReadBuffer() { return _readBuffer; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user