improved stability

This commit is contained in:
orignal 2013-12-29 10:48:57 -05:00
parent ca51567eba
commit 808d6d1fbf
7 changed files with 62 additions and 39 deletions

View file

@ -184,7 +184,8 @@ namespace ntcp
{
if (ecode)
{
LogPrint ("Phase 2 read error: ", ecode.message ());
LogPrint ("Phase 2 read error: ", ecode.message (), ". Wrong ident assumed");
GetRemoteRouterInfo ().SetUnreachable (true); // this RouterInfo is not valid
Terminate ();
}
else
@ -459,10 +460,7 @@ namespace ntcp
m_Adler.CalculateDigest (sendBuffer + len + 2 + padding, sendBuffer, len + 2+ padding);
int l = len + padding + 6;
{
std::lock_guard<std::mutex> lock (m_EncryptionMutex);
m_Encryption.ProcessData(sendBuffer, sendBuffer, l);
}
m_Encryption.ProcessData(sendBuffer, sendBuffer, l);
boost::asio::async_write (m_Socket, boost::asio::buffer (sendBuffer, l), boost::asio::transfer_all (),
boost::bind(&NTCPSession::HandleSent, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred, msg));