mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +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,
|
void SHAMap::getFetchPack (SHAMap* have, bool includeLeaves, int max,
|
||||||
std::function<void (const uint256&, const Blob&)> func)
|
std::function<void (const uint256&, const Blob&)> func)
|
||||||
{
|
{
|
||||||
ScopedReadLockType ul1 (mLock), ul2;
|
ScopedReadLockType ul1 (mLock, boost::defer_lock);
|
||||||
|
ScopedReadLockType ul2;
|
||||||
|
|
||||||
if (have)
|
if (have)
|
||||||
{
|
{
|
||||||
ul2 = std::move (ScopedReadLockType (have->mLock, boost::try_to_lock));
|
assert(this != have);
|
||||||
|
ul2 = ScopedReadLockType (have->mLock, boost::defer_lock);
|
||||||
if (! ul2.owns_lock ())
|
std::lock(ul1, ul2);
|
||||||
{
|
|
||||||
WriteLog (lsINFO, SHAMap) << "Unable to create pack due to lock";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
ul1.lock();
|
||||||
|
|
||||||
if (root->getNodeHash ().isZero ())
|
if (root->getNodeHash ().isZero ())
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user