|
|
@ -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,12 +542,17 @@ 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) |
|
|
|
auto pool = tunnel->GetTunnelPool (); |
|
|
|
{ |
|
|
|
if (pool) |
|
|
|
tunnel->SetIsRecreated (); |
|
|
|
pool->RecreateOutboundTunnel (tunnel); |
|
|
|
auto pool = tunnel->GetTunnelPool (); |
|
|
|
|
|
|
|
if (pool) |
|
|
|
|
|
|
|
pool->RecreateOutboundTunnel (tunnel); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ts + TUNNEL_EXPIRATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT) |
|
|
|
|
|
|
|
tunnel->SetState (eTunnelStateExpiring); |
|
|
|
} |
|
|
|
} |
|
|
|
it++; |
|
|
|
it++; |
|
|
|
} |
|
|
|
} |
|
|
@ -585,12 +590,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) |
|
|
|
auto pool = tunnel->GetTunnelPool (); |
|
|
|
{ |
|
|
|
if (pool) |
|
|
|
tunnel->SetIsRecreated (); |
|
|
|
pool->RecreateInboundTunnel (tunnel); |
|
|
|
auto pool = tunnel->GetTunnelPool (); |
|
|
|
|
|
|
|
if (pool) |
|
|
|
|
|
|
|
pool->RecreateInboundTunnel (tunnel); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ts + TUNNEL_EXPIRATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT) |
|
|
|
|
|
|
|
tunnel->SetState (eTunnelStateExpiring); |
|
|
|
} |
|
|
|
} |
|
|
|
it++; |
|
|
|
it++; |
|
|
|
} |
|
|
|
} |
|
|
|