From f79ad91a9a271058e8a6dc40d80f855e8999be3d Mon Sep 17 00:00:00 2001 From: alexandr Date: Mon, 3 Oct 2016 20:01:31 +0500 Subject: [PATCH] probably fix hanging of call I2CP-SendMsgTo-FindLeaseSet --- Destination.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Destination.cpp b/Destination.cpp index 48717f5f..f06c7711 100644 --- a/Destination.cpp +++ b/Destination.cpp @@ -171,7 +171,7 @@ namespace client std::shared_ptr LeaseSetDestination::FindLeaseSet (const i2p::data::IdentHash& ident) { - std::lock_guard lock(m_RemoteLeaseSetsMutex); + std::unique_lock lock(m_RemoteLeaseSetsMutex); auto it = m_RemoteLeaseSets.find (ident); if (it != m_RemoteLeaseSets.end ()) { @@ -186,7 +186,6 @@ namespace client { ls->PopulateLeases(); { - std::lock_guard _lock(m_RemoteLeaseSetsMutex); m_RemoteLeaseSets[ident] = ls; } } @@ -203,15 +202,12 @@ namespace client if (ls && !ls->IsExpired ()) { ls->PopulateLeases (); // since we don't store them in netdb - { - std::lock_guard lock(m_RemoteLeaseSetsMutex); - m_RemoteLeaseSets[ident] = ls; - } + m_RemoteLeaseSets[ident] = ls; return ls; } } return nullptr; - } + } std::shared_ptr LeaseSetDestination::GetLeaseSet () {