1
0

Fixed one possibility of a deadlock in cClientHandle::SendChunkData()

git-svn-id: http://mc-server.googlecode.com/svn/trunk@809 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-08-31 11:40:54 +00:00
parent 539364846a
commit f8b2cd99a6

View File

@ -90,6 +90,7 @@ cClientHandle::cClientHandle(const cSocket & a_Socket, int a_ViewDistance)
, m_TimeLastPacket(cWorld::GetTime()) , m_TimeLastPacket(cWorld::GetTime())
, m_bKeepThreadGoing(true) , m_bKeepThreadGoing(true)
, m_Ping(1000) , m_Ping(1000)
, m_PingID(1)
, m_State(csConnected) , m_State(csConnected)
, m_LastStreamedChunkX(0x7fffffff) // bogus chunk coords to force streaming upon login , m_LastStreamedChunkX(0x7fffffff) // bogus chunk coords to force streaming upon login
, m_LastStreamedChunkZ(0x7fffffff) , m_LastStreamedChunkZ(0x7fffffff)
@ -1350,6 +1351,7 @@ void cClientHandle::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializ
{ {
// Check chunks being sent, erase them from m_ChunksToSend: // Check chunks being sent, erase them from m_ChunksToSend:
bool Found = false; bool Found = false;
{
cCSLock Lock(m_CSChunkLists); cCSLock Lock(m_CSChunkLists);
for (cChunkCoordsList::iterator itr = m_ChunksToSend.begin(); itr != m_ChunksToSend.end(); ++itr) for (cChunkCoordsList::iterator itr = m_ChunksToSend.begin(); itr != m_ChunksToSend.end(); ++itr)
{ {
@ -1365,6 +1367,7 @@ void cClientHandle::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializ
break; break;
} }
} // for itr - m_ChunksToSend[] } // for itr - m_ChunksToSend[]
}
if (!Found) if (!Found)
{ {
// This just sometimes happens. If you have a reliably replicatable situation for this, go ahead and fix it // This just sometimes happens. If you have a reliably replicatable situation for this, go ahead and fix it