Fix to protocolgame

master
Henrique 12 years ago
parent 614d1544c0
commit 3c1a5f24e8

@ -137,14 +137,7 @@ void Protocol::internalRecvData(uint8* buffer, uint16 size)
g_logger.traceError("failed to decrypt message");
return;
}
} else {
int size = m_inputMessage->getU16();
if(size != m_inputMessage->getUnreadSize()) {
g_logger.traceError("invalid message size");
return;
}
}
onRecv(m_inputMessage);
}

@ -42,6 +42,7 @@ void ProtocolGame::login(const std::string& accountName, const std::string& acco
void ProtocolGame::onConnect()
{
m_firstRecv = true;
Protocol::onConnect();
m_localPlayer = g_game.getLocalPlayer();
@ -57,7 +58,14 @@ void ProtocolGame::onConnect()
void ProtocolGame::onRecv(const InputMessagePtr& inputMessage)
{
//Protocol::onConnect(inputMessage);
if(m_firstRecv) {
m_firstRecv = false;
int size = inputMessage->getU16();
if(size != inputMessage->getUnreadSize()) {
g_logger.traceError("invalid message size");
return;
}
}
parseMessage(inputMessage);
recv();
@ -69,4 +77,3 @@ void ProtocolGame::onError(const boost::system::error_code& error)
g_game.processConnectionError(error);
}

@ -216,6 +216,7 @@ public:
private:
stdext::boolean<false> m_enableSendExtendedOpcode;
stdext::boolean<false> m_gameInitialized;
stdext::boolean<true> m_firstRecv;
std::string m_accountName;
std::string m_accountPassword;
std::string m_characterName;

Loading…
Cancel
Save