Fix to protocolgame

This commit is contained in:
Henrique 2012-07-31 14:23:52 -03:00
parent 614d1544c0
commit 3c1a5f24e8
3 changed files with 10 additions and 9 deletions

View File

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

View File

@ -42,6 +42,7 @@ void ProtocolGame::login(const std::string& accountName, const std::string& acco
void ProtocolGame::onConnect() void ProtocolGame::onConnect()
{ {
m_firstRecv = true;
Protocol::onConnect(); Protocol::onConnect();
m_localPlayer = g_game.getLocalPlayer(); m_localPlayer = g_game.getLocalPlayer();
@ -57,7 +58,14 @@ void ProtocolGame::onConnect()
void ProtocolGame::onRecv(const InputMessagePtr& inputMessage) 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); parseMessage(inputMessage);
recv(); recv();
@ -69,4 +77,3 @@ void ProtocolGame::onError(const boost::system::error_code& error)
g_game.processConnectionError(error); g_game.processConnectionError(error);
} }

View File

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