Browse Source

terminate non-responding NTCP sessions by timeout

pull/158/head
orignal 10 years ago
parent
commit
6783b22ad0
  1. 3
      NTCPSession.cpp

3
NTCPSession.cpp

@ -91,6 +91,7 @@ namespace transport
i2p::DeleteI2NPMessage (m_NextMessage); i2p::DeleteI2NPMessage (m_NextMessage);
m_NextMessage = nullptr; m_NextMessage = nullptr;
} }
m_TerminationTimer.cancel ();
LogPrint (eLogInfo, "NTCP session terminated"); LogPrint (eLogInfo, "NTCP session terminated");
} }
} }
@ -125,6 +126,7 @@ namespace transport
boost::asio::async_write (m_Socket, boost::asio::buffer (&m_Establisher->phase1, sizeof (NTCPPhase1)), boost::asio::transfer_all (), boost::asio::async_write (m_Socket, boost::asio::buffer (&m_Establisher->phase1, sizeof (NTCPPhase1)), boost::asio::transfer_all (),
std::bind(&NTCPSession::HandlePhase1Sent, shared_from_this (), std::placeholders::_1, std::placeholders::_2)); std::bind(&NTCPSession::HandlePhase1Sent, shared_from_this (), std::placeholders::_1, std::placeholders::_2));
ScheduleTermination ();
} }
void NTCPSession::ServerLogin () void NTCPSession::ServerLogin ()
@ -133,6 +135,7 @@ namespace transport
boost::asio::async_read (m_Socket, boost::asio::buffer(&m_Establisher->phase1, sizeof (NTCPPhase1)), boost::asio::transfer_all (), boost::asio::async_read (m_Socket, boost::asio::buffer(&m_Establisher->phase1, sizeof (NTCPPhase1)), boost::asio::transfer_all (),
std::bind(&NTCPSession::HandlePhase1Received, shared_from_this (), std::bind(&NTCPSession::HandlePhase1Received, shared_from_this (),
std::placeholders::_1, std::placeholders::_2)); std::placeholders::_1, std::placeholders::_2));
ScheduleTermination ();
} }
void NTCPSession::HandlePhase1Sent (const boost::system::error_code& ecode, std::size_t bytes_transferred) void NTCPSession::HandlePhase1Sent (const boost::system::error_code& ecode, std::size_t bytes_transferred)

Loading…
Cancel
Save