This commit is contained in:
AlexBeLi 2016-10-03 16:05:51 +00:00 committed by GitHub
commit 75b7f10466
2 changed files with 10 additions and 12 deletions

View file

@ -171,7 +171,7 @@ namespace client
std::shared_ptr<const i2p::data::LeaseSet> LeaseSetDestination::FindLeaseSet (const i2p::data::IdentHash& ident)
{
std::lock_guard<std::mutex> lock(m_RemoteLeaseSetsMutex);
std::unique_lock<std::mutex> lock(m_RemoteLeaseSetsMutex);
auto it = m_RemoteLeaseSets.find (ident);
if (it != m_RemoteLeaseSets.end ())
{
@ -185,11 +185,8 @@ namespace client
if(ls && !ls->IsExpired())
{
ls->PopulateLeases();
{
std::lock_guard<std::mutex> _lock(m_RemoteLeaseSetsMutex);
m_RemoteLeaseSets[ident] = ls;
}
}
});
}
return it->second;
@ -203,10 +200,7 @@ namespace client
if (ls && !ls->IsExpired ())
{
ls->PopulateLeases (); // since we don't store them in netdb
{
std::lock_guard<std::mutex> lock(m_RemoteLeaseSetsMutex);
m_RemoteLeaseSets[ident] = ls;
}
return ls;
}
}

View file

@ -104,6 +104,7 @@ namespace client
auto path = remoteSession->GetSharedRoutingPath ();
std::shared_ptr<i2p::tunnel::OutboundTunnel> outboundTunnel;
std::shared_ptr<const i2p::data::Lease> remoteLease;
bool unconfirmedTags=false;
if (path)
{
if (!remoteSession->CleanupUnconfirmedTags ()) // no stuck tags
@ -112,9 +113,12 @@ namespace client
remoteLease = path->remoteLease;
}
else
{
remoteSession->SetSharedRoutingPath (nullptr);
unconfirmedTags=true;
}
else
}
if (!path || unconfirmedTags)
{
outboundTunnel = GetTunnelPool ()->GetNextOutboundTunnel ();
auto leases = remote->GetNonExpiredLeases ();