|
|
@ -18,7 +18,7 @@ namespace tunnel |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
Tunnel::Tunnel (TunnelConfig * config): |
|
|
|
Tunnel::Tunnel (TunnelConfig * config): |
|
|
|
m_Config (config), m_Pool (nullptr), m_State (eTunnelStatePending) |
|
|
|
m_Config (config), m_Pool (nullptr), m_State (eTunnelStatePending), m_IsRecreated (false) |
|
|
|
{ |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -542,13 +542,18 @@ namespace tunnel |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (tunnel->IsEstablished () && ts + TUNNEL_EXPIRATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT) |
|
|
|
if (tunnel->IsEstablished ()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
tunnel->SetState (eTunnelStateExpiring); |
|
|
|
if (!tunnel->IsRecreated () && ts + TUNNEL_RECREATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
tunnel->SetIsRecreated (); |
|
|
|
auto pool = tunnel->GetTunnelPool (); |
|
|
|
auto pool = tunnel->GetTunnelPool (); |
|
|
|
if (pool) |
|
|
|
if (pool) |
|
|
|
pool->RecreateOutboundTunnel (tunnel); |
|
|
|
pool->RecreateOutboundTunnel (tunnel); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (ts + TUNNEL_EXPIRATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT) |
|
|
|
|
|
|
|
tunnel->SetState (eTunnelStateExpiring); |
|
|
|
|
|
|
|
} |
|
|
|
it++; |
|
|
|
it++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -585,13 +590,19 @@ namespace tunnel |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (tunnel->IsEstablished () && ts + TUNNEL_EXPIRATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT) |
|
|
|
if (tunnel->IsEstablished ()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
tunnel->SetState (eTunnelStateExpiring); |
|
|
|
if (!tunnel->IsRecreated () && ts + TUNNEL_RECREATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
tunnel->SetIsRecreated (); |
|
|
|
auto pool = tunnel->GetTunnelPool (); |
|
|
|
auto pool = tunnel->GetTunnelPool (); |
|
|
|
if (pool) |
|
|
|
if (pool) |
|
|
|
pool->RecreateInboundTunnel (tunnel); |
|
|
|
pool->RecreateInboundTunnel (tunnel); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ts + TUNNEL_EXPIRATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT) |
|
|
|
|
|
|
|
tunnel->SetState (eTunnelStateExpiring); |
|
|
|
|
|
|
|
} |
|
|
|
it++; |
|
|
|
it++; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|