don't recreate tunnels of different size

This commit is contained in:
Jeff Becker 2018-01-02 12:59:16 -05:00
parent ab80def94b
commit 1967dee50c
No known key found for this signature in database
GPG key ID: F357B3B42F6F9B05
2 changed files with 26 additions and 13 deletions

View file

@ -670,10 +670,12 @@ namespace tunnel
{
if (!tunnel->IsRecreated () && ts + TUNNEL_RECREATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)
{
tunnel->SetIsRecreated ();
auto pool = tunnel->GetTunnelPool ();
if (pool)
if (pool && tunnel->GetPeers().size() == pool->GetNumOutboundHops())
{
tunnel->SetIsRecreated ();
pool->RecreateOutboundTunnel (tunnel);
}
}
if (ts + TUNNEL_EXPIRATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)
tunnel->SetState (eTunnelStateExpiring);
@ -723,8 +725,11 @@ namespace tunnel
{
tunnel->SetIsRecreated ();
auto pool = tunnel->GetTunnelPool ();
if (pool)
if (pool && tunnel->GetPeers().size() == pool->GetNumInboundHops())
{
tunnel->SetIsRecreated ();
pool->RecreateInboundTunnel (tunnel);
}
}
if (ts + TUNNEL_EXPIRATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)