mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
fixed hand at shutdown
This commit is contained in:
parent
34d88db0b2
commit
93857b690a
|
@ -446,19 +446,22 @@ namespace transport
|
||||||
|
|
||||||
void Transports::HandlePeerCleanupTimer (const boost::system::error_code& ecode)
|
void Transports::HandlePeerCleanupTimer (const boost::system::error_code& ecode)
|
||||||
{
|
{
|
||||||
auto ts = i2p::util::GetSecondsSinceEpoch ();
|
if (ecode != boost::asio::error::operation_aborted)
|
||||||
for (auto it = m_Peers.begin (); it != m_Peers.end (); )
|
|
||||||
{
|
{
|
||||||
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");
|
if (!it->second.session && ts > it->second.creationTime + SESSION_CREATION_TIMEOUT)
|
||||||
it = m_Peers.erase (it);
|
{
|
||||||
|
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
|
m_PeerCleanupTimer.expires_from_now (boost::posix_time::seconds(5*SESSION_CREATION_TIMEOUT));
|
||||||
it++;
|
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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue