1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-31 13:14:13 +00:00

don't fail last tunnel

This commit is contained in:
orignal 2024-02-23 11:37:09 -05:00
parent 7d73c304b5
commit d4246edb82

View File

@ -337,7 +337,10 @@ namespace tunnel
{ {
it.second.first->SetState (eTunnelStateFailed); it.second.first->SetState (eTunnelStateFailed);
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex); std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
m_OutboundTunnels.erase (it.second.first); if (m_OutboundTunnels.size () > 1) // don't fail last tunnel
m_OutboundTunnels.erase (it.second.first);
else
it.second.first->SetState (eTunnelStateTestFailed);
} }
else else
it.second.first->SetState (eTunnelStateTestFailed); it.second.first->SetState (eTunnelStateTestFailed);
@ -349,7 +352,10 @@ namespace tunnel
it.second.second->SetState (eTunnelStateFailed); it.second.second->SetState (eTunnelStateFailed);
{ {
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex); std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
m_InboundTunnels.erase (it.second.second); if (m_InboundTunnels.size () > 1) // don't fail last tunnel
m_InboundTunnels.erase (it.second.second);
else
it.second.first->SetState (eTunnelStateTestFailed);
} }
if (m_LocalDestination) if (m_LocalDestination)
m_LocalDestination->SetLeaseSetUpdated (); m_LocalDestination->SetLeaseSetUpdated ();