diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-09-08 12:24:06 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-09-08 12:24:06 +0200 |
commit | 38124bcce3c5e8ed8e4dba904dc4f15f89a82c14 (patch) | |
tree | 7f28ca9ff1c9d024c67ca9cdd1b8e66d29a30640 /src/Protocol/Protocol17x.cpp | |
parent | Added GetProtocolVersion() to cProtocol. (diff) | |
download | cuberite-38124bcce3c5e8ed8e4dba904dc4f15f89a82c14.tar cuberite-38124bcce3c5e8ed8e4dba904dc4f15f89a82c14.tar.gz cuberite-38124bcce3c5e8ed8e4dba904dc4f15f89a82c14.tar.bz2 cuberite-38124bcce3c5e8ed8e4dba904dc4f15f89a82c14.tar.lz cuberite-38124bcce3c5e8ed8e4dba904dc4f15f89a82c14.tar.xz cuberite-38124bcce3c5e8ed8e4dba904dc4f15f89a82c14.tar.zst cuberite-38124bcce3c5e8ed8e4dba904dc4f15f89a82c14.zip |
Diffstat (limited to 'src/Protocol/Protocol17x.cpp')
-rw-r--r-- | src/Protocol/Protocol17x.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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)) |