Fixed two race conditions.

This commit is contained in:
lotodore
2007-10-30 21:25:10 +00:00
parent fee8450a74
commit b0524a59ff
3 changed files with 46 additions and 27 deletions
+4 -2
View File
@@ -22,6 +22,7 @@
#include <net/socket_msg.h>
#include <net/socket_helper.h>
#include <cstring>
#include <cassert>
#include <core/boost/timers.hpp>
#include <boost/bind.hpp>
@@ -203,15 +204,15 @@ SenderThread::Main()
Msleep(SEND_TIMEOUT_MSEC);
}
}
else
else // other errors than would block
{
// Skip this packet - this is bad, and is therefore reported.
// Ignore invalid or not connected sockets.
if (errCode != SOCKET_ERR_NOTCONN && errCode != SOCKET_ERR_NOTSOCK)
m_callback.SignalNetError(m_curSession->GetId(), ERR_SOCK_SEND_FAILED, errCode);
RemoveCurSendData();
Msleep(SEND_TIMEOUT_MSEC);
}
Msleep(SEND_TIMEOUT_MSEC);
}
else if ((unsigned)bytesSent < m_tmpOutBufSize)
{
@@ -225,6 +226,7 @@ SenderThread::Main()
}
else
{
assert(bytesSent == m_tmpOutBufSize);
m_tmpOutBufSize = 0;
m_curSession.reset();
sendTimer.reset();