mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
don't include old tunnel to LeaseSet if recreated
This commit is contained in:
parent
ad036de69d
commit
5e2e1a1e3d
3 changed files with 19 additions and 6 deletions
|
@ -113,6 +113,17 @@ namespace tunnel
|
|||
if (!m_IsActive) return;
|
||||
{
|
||||
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
||||
if (createdTunnel->IsRecreated ())
|
||||
{
|
||||
// find and mark old tunnel as expired
|
||||
createdTunnel->SetRecreated (false);
|
||||
for (auto& it: m_InboundTunnels)
|
||||
if (it->IsRecreated () && it->GetNextIdentHash () == createdTunnel->GetNextIdentHash ())
|
||||
{
|
||||
it->SetState (eTunnelStateExpiring);
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_InboundTunnels.insert (createdTunnel);
|
||||
}
|
||||
if (m_LocalDestination)
|
||||
|
@ -577,6 +588,8 @@ namespace tunnel
|
|||
auto newTunnel = tunnels.CreateInboundTunnel (config, shared_from_this(), outboundTunnel);
|
||||
if (newTunnel->IsEstablished ()) // zero hops
|
||||
TunnelCreated (newTunnel);
|
||||
else
|
||||
newTunnel->SetRecreated (true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue