fix protocol crash
This commit is contained in:
parent
f54fd34cb3
commit
c6b9aad87d
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue