Another possible deadlock in cClientHandle averted. Hope this is the one.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@810 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
f8b2cd99a6
commit
acc4be8034
@ -94,6 +94,7 @@ cClientHandle::cClientHandle(const cSocket & a_Socket, int a_ViewDistance)
|
||||
, m_State(csConnected)
|
||||
, m_LastStreamedChunkX(0x7fffffff) // bogus chunk coords to force streaming upon login
|
||||
, m_LastStreamedChunkZ(0x7fffffff)
|
||||
, m_ShouldCheckDownloaded(false)
|
||||
, m_UniqueID(0)
|
||||
{
|
||||
m_Protocol = new cProtocolRecognizer(this);
|
||||
@ -923,8 +924,9 @@ void cClientHandle::SendData(const char * a_Data, int a_Size)
|
||||
cCSLock Lock(m_CSOutgoingData);
|
||||
if (!m_OutgoingData.Write(a_Data, a_Size))
|
||||
{
|
||||
// Client has too much outgoing data queued, drop them silently:
|
||||
Destroy();
|
||||
// Client has too much outgoing data queued, drop them silently by timing them out:
|
||||
// (So that they're dropped in the tick thread and not the sender thread)
|
||||
m_LastPingTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -979,6 +981,12 @@ void cClientHandle::Tick(float a_Dt)
|
||||
Destroy();
|
||||
}
|
||||
|
||||
if ((m_State == csDownloadingWorld) && m_ShouldCheckDownloaded)
|
||||
{
|
||||
CheckIfWorldDownloaded();
|
||||
m_ShouldCheckDownloaded = false;
|
||||
}
|
||||
|
||||
cTimer t1;
|
||||
// Send ping packet
|
||||
if (
|
||||
@ -1359,9 +1367,9 @@ void cClientHandle::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializ
|
||||
{
|
||||
m_ChunksToSend.erase(itr);
|
||||
|
||||
// TODO: _X: Decouple this from packet sending, it creates a deadlock possibility
|
||||
// -- postpone till Tick() instead, using a bool flag
|
||||
CheckIfWorldDownloaded();
|
||||
// Make the tick thread check if all the needed chunks have been downloaded
|
||||
// -- needed to offload this from here due to a deadlock possibility
|
||||
m_ShouldCheckDownloaded = true;
|
||||
|
||||
Found = true;
|
||||
break;
|
||||
|
@ -224,6 +224,9 @@ private:
|
||||
|
||||
bool m_bKeepThreadGoing;
|
||||
|
||||
/// If set to true during csDownloadingWorld, the tick thread calls CheckIfWorldDownloaded()
|
||||
bool m_ShouldCheckDownloaded;
|
||||
|
||||
/// Returns true if the rate block interactions is within a reasonable limit (bot protection)
|
||||
bool CheckBlockInteractionsRate(void);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user