Browse Source

fixed deadlock

pull/2072/head
orignal 7 months ago
parent
commit
285e693a4e
  1. 8
      libi2pd/TunnelPool.cpp

8
libi2pd/TunnelPool.cpp

@ -364,17 +364,21 @@ namespace tunnel @@ -364,17 +364,21 @@ namespace tunnel
if (it.second.second->GetState () == eTunnelStateTestFailed)
{
it.second.second->SetState (eTunnelStateFailed);
{
bool failed = false;
{
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
if (m_InboundTunnels.size () > 1 || m_NumInboundTunnels <= 1) // don't fail last tunnel
{
m_InboundTunnels.erase (it.second.second);
if (m_LocalDestination)
m_LocalDestination->SetLeaseSetUpdated ();
failed = true;
}
else
it.second.second->SetState (eTunnelStateTestFailed);
}
if (failed && m_LocalDestination)
m_LocalDestination->SetLeaseSetUpdated ();
}
if (m_LocalDestination)
m_LocalDestination->SetLeaseSetUpdated ();
}

Loading…
Cancel
Save