mirror of
https://github.com/edubart/otclient.git
synced 2025-11-30 15:26:49 +01:00
fix protocol crash
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user