mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
delete invalid sessions from peers
This commit is contained in:
parent
648b09d45f
commit
8320987124
2 changed files with 8 additions and 2 deletions
|
@ -743,7 +743,12 @@ namespace transport
|
|||
auto ts = i2p::util::GetSecondsSinceEpoch ();
|
||||
for (auto it = m_Peers.begin (); it != m_Peers.end (); )
|
||||
{
|
||||
if (it->second.sessions.empty () && ts > it->second.creationTime + SESSION_CREATION_TIMEOUT)
|
||||
it->second.sessions.remove_if (
|
||||
[](std::shared_ptr<TransportSession> session)->bool
|
||||
{
|
||||
return !session || !session->IsEstablished ();
|
||||
});
|
||||
if (it->second.sessions.empty () && ts > it->second.creationTime + SESSION_CREATION_TIMEOUT)
|
||||
{
|
||||
LogPrint (eLogWarning, "Transports: Session to peer ", it->first.ToBase64 (), " has not been created in ", SESSION_CREATION_TIMEOUT, " seconds");
|
||||
auto profile = i2p::data::GetRouterProfile(it->first);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue