Skip to content

Commit

Permalink
fail last tunnel if tunnel quantity is 1
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Feb 23, 2024
1 parent 43d8807 commit 8524a67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libi2pd/TunnelPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ namespace tunnel
{
it.second.first->SetState (eTunnelStateFailed);
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
if (m_OutboundTunnels.size () > 1) // don't fail last tunnel
if (m_OutboundTunnels.size () > 1 || m_NumOutboundTunnels <= 1) // don't fail last tunnel
m_OutboundTunnels.erase (it.second.first);
else
it.second.first->SetState (eTunnelStateTestFailed);
Expand All @@ -352,7 +352,7 @@ namespace tunnel
it.second.second->SetState (eTunnelStateFailed);
{
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
if (m_InboundTunnels.size () > 1) // don't fail last tunnel
if (m_InboundTunnels.size () > 1 || m_NumInboundTunnels <= 1) // don't fail last tunnel
m_InboundTunnels.erase (it.second.second);
else
it.second.first->SetState (eTunnelStateTestFailed);
Expand Down

0 comments on commit 8524a67

Please sign in to comment.