summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-31 13:40:54 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-31 13:40:54 +0200
commitf8b2cd99a652def42f44efd82a77d90ff3d074de (patch)
tree03eb5327cc449ce4cd13a324721311b0cb7b229f
parentImplemented 1.3.2 protocol encryption using CryptoPP, up to Client Status packet (http://wiki.vg/Protocol_FAQ step 14) (diff)
downloadcuberite-f8b2cd99a652def42f44efd82a77d90ff3d074de.tar
cuberite-f8b2cd99a652def42f44efd82a77d90ff3d074de.tar.gz
cuberite-f8b2cd99a652def42f44efd82a77d90ff3d074de.tar.bz2
cuberite-f8b2cd99a652def42f44efd82a77d90ff3d074de.tar.lz
cuberite-f8b2cd99a652def42f44efd82a77d90ff3d074de.tar.xz
cuberite-f8b2cd99a652def42f44efd82a77d90ff3d074de.tar.zst
cuberite-f8b2cd99a652def42f44efd82a77d90ff3d074de.zip
-rw-r--r--source/cClientHandle.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index 0877dba2c..4db64cfde 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -90,6 +90,7 @@ cClientHandle::cClientHandle(const cSocket & a_Socket, int a_ViewDistance)
, m_TimeLastPacket(cWorld::GetTime())
, m_bKeepThreadGoing(true)
, m_Ping(1000)
+ , m_PingID(1)
, m_State(csConnected)
, m_LastStreamedChunkX(0x7fffffff) // bogus chunk coords to force streaming upon login
, m_LastStreamedChunkZ(0x7fffffff)
@@ -1350,21 +1351,23 @@ void cClientHandle::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializ
{
// Check chunks being sent, erase them from m_ChunksToSend:
bool Found = false;
- cCSLock Lock(m_CSChunkLists);
- for (cChunkCoordsList::iterator itr = m_ChunksToSend.begin(); itr != m_ChunksToSend.end(); ++itr)
{
- if ((itr->m_ChunkX == a_ChunkX) && (itr->m_ChunkZ == a_ChunkZ))
+ cCSLock Lock(m_CSChunkLists);
+ for (cChunkCoordsList::iterator itr = m_ChunksToSend.begin(); itr != m_ChunksToSend.end(); ++itr)
{
- 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();
-
- Found = true;
- break;
- }
- } // for itr - m_ChunksToSend[]
+ if ((itr->m_ChunkX == a_ChunkX) && (itr->m_ChunkZ == a_ChunkZ))
+ {
+ 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();
+
+ Found = true;
+ break;
+ }
+ } // for itr - m_ChunksToSend[]
+ }
if (!Found)
{
// This just sometimes happens. If you have a reliably replicatable situation for this, go ahead and fix it