From 93857b690a42d2b24e2fef3d94b430a35a2bc76f Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 11 Feb 2015 22:48:26 -0500 Subject: [PATCH] fixed hand at shutdown --- Transports.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/Transports.cpp b/Transports.cpp index 713f4ea1..1340d8f5 100644 --- a/Transports.cpp +++ b/Transports.cpp @@ -446,19 +446,22 @@ namespace transport void Transports::HandlePeerCleanupTimer (const boost::system::error_code& ecode) { - auto ts = i2p::util::GetSecondsSinceEpoch (); - for (auto it = m_Peers.begin (); it != m_Peers.end (); ) + if (ecode != boost::asio::error::operation_aborted) { - if (!it->second.session && ts > it->second.creationTime + SESSION_CREATION_TIMEOUT) + auto ts = i2p::util::GetSecondsSinceEpoch (); + for (auto it = m_Peers.begin (); it != m_Peers.end (); ) { - LogPrint (eLogError, "Session to peer ", it->first.ToBase64 (), " has not been created in ", SESSION_CREATION_TIMEOUT, " seconds"); - it = m_Peers.erase (it); + if (!it->second.session && ts > it->second.creationTime + SESSION_CREATION_TIMEOUT) + { + LogPrint (eLogError, "Session to peer ", it->first.ToBase64 (), " has not been created in ", SESSION_CREATION_TIMEOUT, " seconds"); + it = m_Peers.erase (it); + } + else + it++; } - else - it++; - } - m_PeerCleanupTimer.expires_from_now (boost::posix_time::seconds(5*SESSION_CREATION_TIMEOUT)); - m_PeerCleanupTimer.async_wait (std::bind (&Transports::HandlePeerCleanupTimer, this, std::placeholders::_1)); + m_PeerCleanupTimer.expires_from_now (boost::posix_time::seconds(5*SESSION_CREATION_TIMEOUT)); + m_PeerCleanupTimer.async_wait (std::bind (&Transports::HandlePeerCleanupTimer, this, std::placeholders::_1)); + } } } }