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:
Shauren
2024-04-03 21:23:30 +02:00
parent f1b7ca1a91
commit f847cd4eeb
2 changed files with 9 additions and 1 deletions

View File

@@ -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;

View File

@@ -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; }