From c4a27b4b2aa11daf648350f57c8aa0d620166120 Mon Sep 17 00:00:00 2001 From: Mark Samman Date: Fri, 8 Nov 2013 03:47:25 +0100 Subject: [PATCH] Fix client debug assertion with large packets --- src/networkmessage.h | 1 + src/protocol.cpp | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/networkmessage.h b/src/networkmessage.h index 22e842cab4..f694022535 100644 --- a/src/networkmessage.h +++ b/src/networkmessage.h @@ -36,6 +36,7 @@ class NetworkMessage enum { crypto_length = 4 }; enum { xtea_multiple = 8 }; enum { max_body_length = NETWORKMESSAGE_MAXSIZE - header_length - crypto_length - xtea_multiple }; + enum { max_protocol_body_length = max_body_length - 10 }; // constructor/destructor NetworkMessage() { diff --git a/src/protocol.cpp b/src/protocol.cpp index 6c0c81ace6..400a1d3b6f 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -56,13 +56,12 @@ void Protocol::onRecvMessage(NetworkMessage& msg) OutputMessage_ptr Protocol::getOutputBuffer(int32_t size) { - if (m_outputBuffer && NetworkMessage::max_body_length >= m_outputBuffer->getMessageLength() + size) { + if (m_outputBuffer && NetworkMessage::max_protocol_body_length >= m_outputBuffer->getMessageLength() + size) { return m_outputBuffer; } else if (m_connection) { m_outputBuffer = OutputMessagePool::getInstance()->getOutputMessage(this); return m_outputBuffer; } - return OutputMessage_ptr(); }