Browse Source

fixed deadlock

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

22
libi2pd/TunnelPool.cpp

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

Loading…
Cancel
Save