protocol login working

This commit is contained in:
Henrique Santiago
2012-06-05 18:27:37 -03:00
parent 6b9943447a
commit 3cb5216858
12 changed files with 172 additions and 348 deletions

View File

@@ -91,6 +91,9 @@ void OutputMessage::addPaddingBytes(int bytes, uint8 byte)
void OutputMessage::encryptRSA(int size, const std::string& key)
{
if(m_writePos - size < 0)
throw NetworkException("writePos - size < 0");
RSA::encrypt((char*)m_buffer + m_writePos - size, size, key.c_str());
}

View File

@@ -229,3 +229,14 @@ void Protocol::onConnect()
{
callLuaField("onConnect");
}
void Protocol::onRecv(const InputMessagePtr& inputMessage)
{
callLuaField("onRecv", inputMessage);
}
void Protocol::onError(const boost::system::error_code& err)
{
callLuaField("onError", err.message(), true);
disconnect();
}

View File

@@ -54,8 +54,8 @@ public:
protected:
virtual void onConnect();
virtual void onRecv(const InputMessagePtr& inputMessage) {}
virtual void onError(const boost::system::error_code& err) {}
virtual void onRecv(const InputMessagePtr& inputMessage);
virtual void onError(const boost::system::error_code& err);
uint32 m_xteaKey[4];