From 6783b22ad008a2363338bd146d0af723b04af843 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 10 Feb 2015 10:54:04 -0500 Subject: [PATCH] terminate non-responding NTCP sessions by timeout --- NTCPSession.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NTCPSession.cpp b/NTCPSession.cpp index 6184a377..570c5e56 100644 --- a/NTCPSession.cpp +++ b/NTCPSession.cpp @@ -91,6 +91,7 @@ namespace transport i2p::DeleteI2NPMessage (m_NextMessage); m_NextMessage = nullptr; } + m_TerminationTimer.cancel (); 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 (), std::bind(&NTCPSession::HandlePhase1Sent, shared_from_this (), std::placeholders::_1, std::placeholders::_2)); + ScheduleTermination (); } 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 (), std::bind(&NTCPSession::HandlePhase1Received, shared_from_this (), std::placeholders::_1, std::placeholders::_2)); + ScheduleTermination (); } void NTCPSession::HandlePhase1Sent (const boost::system::error_code& ecode, std::size_t bytes_transferred)