aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-04-03 21:23:30 +0200
committerShauren <shauren.trinity@gmail.com>2024-04-03 21:23:30 +0200
commitf847cd4eeb8ce0d537ef793d8926cf28650724c4 (patch)
tree5ecdc8abf04be2ccef700495e93b8835142a90cd /src
parentf1b7ca1a91a93410b900da832df0a189f8fb3717 (diff)
Core/Networking: Fixed Socket::DelayedCloseSocket not working if write queue is empty when its called on linux and mac
Closes #29887
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Server/WorldSocket.cpp1
-rw-r--r--src/server/shared/Networking/Socket.h9
2 files changed, 9 insertions, 1 deletions
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index d4317cf5e14..7a3a1841853 100644
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -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;
diff --git a/src/server/shared/Networking/Socket.h b/src/server/shared/Networking/Socket.h
index 511f94ed366..40f5820da92 100644
--- a/src/server/shared/Networking/Socket.h
+++ b/src/server/shared/Networking/Socket.h
@@ -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; }