Skip to content

Commit

Permalink
Fix client debug assertion with large packets
Browse files Browse the repository at this point in the history
  • Loading branch information
marksamman committed Nov 9, 2013
1 parent 522edda commit c4a27b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/networkmessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions src/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit c4a27b4

Please sign in to comment.