mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-01 00:15:51 +00:00
Eliminate spurious SHAMap::getFetchPack failure (RIPD-379)
This commit is contained in:
committed by
Vinnie Falco
parent
1ce0f94638
commit
28898031f0
@@ -637,19 +637,17 @@ static void addFPtoList (std::list<SHAMap::fetchPackEntry_t>& list, const uint25
|
||||
void SHAMap::getFetchPack (SHAMap* have, bool includeLeaves, int max,
|
||||
std::function<void (const uint256&, const Blob&)> func)
|
||||
{
|
||||
ScopedReadLockType ul1 (mLock), ul2;
|
||||
ScopedReadLockType ul1 (mLock, boost::defer_lock);
|
||||
ScopedReadLockType ul2;
|
||||
|
||||
if (have)
|
||||
{
|
||||
ul2 = std::move (ScopedReadLockType (have->mLock, boost::try_to_lock));
|
||||
|
||||
if (! ul2.owns_lock ())
|
||||
{
|
||||
WriteLog (lsINFO, SHAMap) << "Unable to create pack due to lock";
|
||||
return;
|
||||
}
|
||||
assert(this != have);
|
||||
ul2 = ScopedReadLockType (have->mLock, boost::defer_lock);
|
||||
std::lock(ul1, ul2);
|
||||
}
|
||||
|
||||
else
|
||||
ul1.lock();
|
||||
|
||||
if (root->getNodeHash ().isZero ())
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user