mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
recreate tunnel after 9.5 minutes
This commit is contained in:
parent
fcb56db224
commit
3987d5e5a0
3 changed files with 29 additions and 11 deletions
33
Tunnel.cpp
33
Tunnel.cpp
|
@ -18,7 +18,7 @@ namespace tunnel
|
|||
{
|
||||
|
||||
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
|
||||
{
|
||||
if (tunnel->IsEstablished () && ts + TUNNEL_EXPIRATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)
|
||||
if (tunnel->IsEstablished ())
|
||||
{
|
||||
tunnel->SetState (eTunnelStateExpiring);
|
||||
auto pool = tunnel->GetTunnelPool ();
|
||||
if (pool)
|
||||
pool->RecreateOutboundTunnel (tunnel);
|
||||
if (!tunnel->IsRecreated () && ts + TUNNEL_RECREATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)
|
||||
{
|
||||
tunnel->SetIsRecreated ();
|
||||
auto pool = tunnel->GetTunnelPool ();
|
||||
if (pool)
|
||||
pool->RecreateOutboundTunnel (tunnel);
|
||||
}
|
||||
if (ts + TUNNEL_EXPIRATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)
|
||||
tunnel->SetState (eTunnelStateExpiring);
|
||||
}
|
||||
it++;
|
||||
}
|
||||
|
@ -585,12 +590,18 @@ namespace tunnel
|
|||
}
|
||||
else
|
||||
{
|
||||
if (tunnel->IsEstablished () && ts + TUNNEL_EXPIRATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)
|
||||
if (tunnel->IsEstablished ())
|
||||
{
|
||||
tunnel->SetState (eTunnelStateExpiring);
|
||||
auto pool = tunnel->GetTunnelPool ();
|
||||
if (pool)
|
||||
pool->RecreateInboundTunnel (tunnel);
|
||||
if (!tunnel->IsRecreated () && ts + TUNNEL_RECREATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)
|
||||
{
|
||||
tunnel->SetIsRecreated ();
|
||||
auto pool = tunnel->GetTunnelPool ();
|
||||
if (pool)
|
||||
pool->RecreateInboundTunnel (tunnel);
|
||||
}
|
||||
|
||||
if (ts + TUNNEL_EXPIRATION_THRESHOLD > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)
|
||||
tunnel->SetState (eTunnelStateExpiring);
|
||||
}
|
||||
it++;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue