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

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