mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-31 13:14:13 +00:00
consider test failed state as established. Delete failed tunnels sooner
This commit is contained in:
parent
def404b61a
commit
6439e227f6
@ -679,9 +679,10 @@ namespace tunnel
|
|||||||
for (auto it = m_OutboundTunnels.begin (); it != m_OutboundTunnels.end ();)
|
for (auto it = m_OutboundTunnels.begin (); it != m_OutboundTunnels.end ();)
|
||||||
{
|
{
|
||||||
auto tunnel = *it;
|
auto tunnel = *it;
|
||||||
if (ts > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT)
|
if (tunnel->IsFailed () || ts > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT ||
|
||||||
|
ts + TUNNEL_EXPIRATION_TIMEOUT < tunnel->GetCreationTime ())
|
||||||
{
|
{
|
||||||
LogPrint (eLogDebug, "Tunnel: Tunnel with id ", tunnel->GetTunnelID (), " expired");
|
LogPrint (eLogDebug, "Tunnel: Tunnel with id ", tunnel->GetTunnelID (), " expired or failed");
|
||||||
auto pool = tunnel->GetTunnelPool ();
|
auto pool = tunnel->GetTunnelPool ();
|
||||||
if (pool)
|
if (pool)
|
||||||
pool->TunnelExpired (tunnel);
|
pool->TunnelExpired (tunnel);
|
||||||
@ -730,10 +731,10 @@ namespace tunnel
|
|||||||
for (auto it = m_InboundTunnels.begin (); it != m_InboundTunnels.end ();)
|
for (auto it = m_InboundTunnels.begin (); it != m_InboundTunnels.end ();)
|
||||||
{
|
{
|
||||||
auto tunnel = *it;
|
auto tunnel = *it;
|
||||||
if (ts > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT ||
|
if (tunnel->IsFailed () || ts > tunnel->GetCreationTime () + TUNNEL_EXPIRATION_TIMEOUT ||
|
||||||
ts + TUNNEL_EXPIRATION_TIMEOUT < tunnel->GetCreationTime ())
|
ts + TUNNEL_EXPIRATION_TIMEOUT < tunnel->GetCreationTime ())
|
||||||
{
|
{
|
||||||
LogPrint (eLogDebug, "Tunnel: Tunnel with id ", tunnel->GetTunnelID (), " expired");
|
LogPrint (eLogDebug, "Tunnel: Tunnel with id ", tunnel->GetTunnelID (), " expired or failed");
|
||||||
auto pool = tunnel->GetTunnelPool ();
|
auto pool = tunnel->GetTunnelPool ();
|
||||||
if (pool)
|
if (pool)
|
||||||
pool->TunnelExpired (tunnel);
|
pool->TunnelExpired (tunnel);
|
||||||
|
@ -91,7 +91,7 @@ namespace tunnel
|
|||||||
i2p::data::RouterInfo::CompatibleTransports GetFarEndTransports () const { return m_FarEndTransports; };
|
i2p::data::RouterInfo::CompatibleTransports GetFarEndTransports () const { return m_FarEndTransports; };
|
||||||
TunnelState GetState () const { return m_State; };
|
TunnelState GetState () const { return m_State; };
|
||||||
void SetState (TunnelState state);
|
void SetState (TunnelState state);
|
||||||
bool IsEstablished () const { return m_State == eTunnelStateEstablished; };
|
bool IsEstablished () const { return m_State == eTunnelStateEstablished || m_State == eTunnelStateTestFailed; };
|
||||||
bool IsFailed () const { return m_State == eTunnelStateFailed; };
|
bool IsFailed () const { return m_State == eTunnelStateFailed; };
|
||||||
bool IsRecreated () const { return m_IsRecreated; };
|
bool IsRecreated () const { return m_IsRecreated; };
|
||||||
void SetRecreated (bool recreated) { m_IsRecreated = recreated; };
|
void SetRecreated (bool recreated) { m_IsRecreated = recreated; };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user