From f7b8a301f8a705cec6df17c7051164169cf619a6 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Wed, 3 Jul 2013 07:47:35 +0000 Subject: Fixed player moving between worlds. Fixes FS #407. Also fixes a few possible deadlocks between SocketThreads and TickThread git-svn-id: http://mc-server.googlecode.com/svn/trunk@1641 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/ClientHandle.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/ClientHandle.h') diff --git a/source/ClientHandle.h b/source/ClientHandle.h index cd0ca1ee6..c02924ebf 100644 --- a/source/ClientHandle.h +++ b/source/ClientHandle.h @@ -185,6 +185,7 @@ public: bool HandleLogin(int a_ProtocolVersion, const AString & a_Username); void SendData(const char * a_Data, int a_Size); + private: int m_ViewDistance; // Number of chunks the player can see in each direction; 4 is the minimum ( http://wiki.vg/Protocol_FAQ#.E2.80.A6all_connecting_clients_spasm_and_jerk_uncontrollably.21 ) @@ -270,6 +271,12 @@ private: /// Running sum of m_NumExplosionsPerTick[] int m_RunningSumExplosions; + /// Lock for the m_PendingMessages buffer + cCriticalSection m_CSMessages; + + /// Buffer for received messages to be processed in the Tick thread + AStringList m_PendingMessages; + /// Returns true if the rate block interactions is within a reasonable limit (bot protection) @@ -292,6 +299,9 @@ private: /// Handles the block placing packet when it is a real block placement (not block-using, item-using or eating) void HandlePlaceBlock(int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, cItemHandler & a_ItemHandler); + + /// Processes the messages in m_PendingMessages; called from the Tick thread + void ProcessPendingMessages(void); // cSocketThreads::cCallback overrides: virtual void DataReceived (const char * a_Data, int a_Size) override; // Data is received from the client -- cgit v1.2.3