fix protocol crash

This commit is contained in:
Eduardo Bart 2011-08-28 23:08:02 -03:00
parent f54fd34cb3
commit c6b9aad87d
1 changed files with 6 additions and 3 deletions

View File

@ -61,6 +61,7 @@ void Protocol::send(OutputMessage& outputMessage)
outputMessage.addU16(messageSize);
// send
if(m_connection)
m_connection->write(outputMessage.getBuffer(), outputMessage.getMessageSize());
}
@ -68,6 +69,7 @@ void Protocol::recv()
{
m_inputMessage.reset();
if(m_connection)
m_connection->read(InputMessage::HEADER_LENGTH, std::bind(&Protocol::internalRecvHeader, asProtocol(), _1, _2));
}
@ -80,6 +82,7 @@ void Protocol::internalRecvHeader(uint8* buffer, uint16 size)
m_inputMessage.setMessageSize(dataSize);
// schedule read for message data
if(m_connection)
m_connection->read(dataSize, std::bind(&Protocol::internalRecvData, asProtocol(), _1, _2));
}