Core/Networking: Fixed DelayedCloseSocket when compiled without TC_SOCKET_USE_IOCP (linux)

Closes #16769
This commit is contained in:
Shauren
2016-03-12 19:43:07 +01:00
parent 16953c9025
commit 0daba931ef

View File

@@ -55,11 +55,11 @@ public:
virtual bool Update()
{
if (!IsOpen())
if (_closed)
return false;
#ifndef TC_SOCKET_USE_IOCP
if (_isWritingAsync || _writeQueue.empty())
if (_isWritingAsync || (_writeQueue.empty() && !_closing))
return true;
for (; HandleQueue();)
@@ -164,7 +164,6 @@ protected:
GetRemoteIpAddress().to_string().c_str(), err.value(), err.message().c_str());
}
private:
void ReadHandlerInternal(boost::system::error_code error, size_t transferredBytes)
{
@@ -208,9 +207,6 @@ private:
bool HandleQueue()
{
if (!IsOpen())
return false;
if (_writeQueue.empty())
return false;
@@ -227,11 +223,15 @@ private:
return AsyncProcessQueue();
_writeQueue.pop();
if (_closing && _writeQueue.empty())
CloseSocket();
return false;
}
else if (bytesSent == 0)
{
_writeQueue.pop();
if (_closing && _writeQueue.empty())
CloseSocket();
return false;
}
else if (bytesSent < bytesToSend) // now n > 0
@@ -241,6 +241,8 @@ private:
}
_writeQueue.pop();
if (_closing && _writeQueue.empty())
CloseSocket();
return !_writeQueue.empty();
}