mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
delete expired tunnels
This commit is contained in:
parent
30b25e9eeb
commit
ab5576c744
4 changed files with 26 additions and 35 deletions
|
@ -34,6 +34,9 @@ namespace tunnel
|
|||
{
|
||||
expiredTunnel->SetTunnelPool (nullptr);
|
||||
m_InboundTunnels.erase (expiredTunnel);
|
||||
for (auto it: m_Tests)
|
||||
if (it.second.second == expiredTunnel) it.second.second = nullptr;
|
||||
|
||||
}
|
||||
m_LocalDestination.UpdateLeaseSet ();
|
||||
}
|
||||
|
@ -49,6 +52,8 @@ namespace tunnel
|
|||
{
|
||||
expiredTunnel->SetTunnelPool (nullptr);
|
||||
m_OutboundTunnels.erase (expiredTunnel);
|
||||
for (auto it: m_Tests)
|
||||
if (it.second.first == expiredTunnel) it.second.first = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,10 +110,16 @@ namespace tunnel
|
|||
{
|
||||
LogPrint ("Tunnel test ", (int)it.first, " failed");
|
||||
// both outbound and inbound tunnels considered as invalid
|
||||
it.second.first->SetFailed (true);
|
||||
it.second.second->SetFailed (true);
|
||||
m_OutboundTunnels.erase (it.second.first);
|
||||
m_InboundTunnels.erase (it.second.second);
|
||||
if (it.second.first)
|
||||
{
|
||||
it.second.first->SetFailed (true);
|
||||
m_OutboundTunnels.erase (it.second.first);
|
||||
}
|
||||
if (it.second.second)
|
||||
{
|
||||
it.second.second->SetFailed (true);
|
||||
m_InboundTunnels.erase (it.second.second);
|
||||
}
|
||||
}
|
||||
m_Tests.clear ();
|
||||
auto it1 = m_OutboundTunnels.begin ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue