From 38124bcce3c5e8ed8e4dba904dc4f15f89a82c14 Mon Sep 17 00:00:00 2001 From: Howaner Date: Mon, 8 Sep 2014 12:24:06 +0200 Subject: Updated chunk sending to 1.8 --- src/Protocol/Protocol17x.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/Protocol/Protocol17x.cpp') diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index e34a61818..34bfbc82b 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -1503,14 +1503,14 @@ void cProtocol172::AddReceivedData(const char * a_Data, size_t a_Size) ); m_CommLogFile.Flush(); } - + if (!m_ReceivedData.Write(a_Data, a_Size)) { // Too much data in the incoming queue, report to caller: m_Client->PacketBufferFull(); return; } - + // Handle all complete packets: for (;;) { @@ -1530,10 +1530,7 @@ void cProtocol172::AddReceivedData(const char * a_Data, size_t a_Size) cByteBuffer bb(PacketLen + 1); VERIFY(m_ReceivedData.ReadToByteBuffer(bb, (int)PacketLen)); m_ReceivedData.CommitRead(); - - // Write one NUL extra, so that we can detect over-reads - bb.Write("\0", 1); - + // 1.8 - Compressed packets if ((m_State == 3) && (GetProtocolVersion() == cProtocolRecognizer::PROTO_VERSION_1_8_0)) { @@ -1544,6 +1541,9 @@ void cProtocol172::AddReceivedData(const char * a_Data, size_t a_Size) break; } } + + // Write one NUL extra, so that we can detect over-reads + bb.Write("\0", 1); UInt32 PacketType; if (!bb.ReadVarInt(PacketType)) -- cgit v1.2.3