Core/Networking: Fixed Socket::DelayedCloseSocket not working if write queue is empty when its called on linux and mac

Closes #29887

(cherry picked from commit f847cd4eeb)
This commit is contained in:
Shauren
2024-04-03 21:23:30 +02:00
parent 05ca1eb89f
commit dacc11b8ea

View File

@@ -127,7 +127,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; }