diff --git a/src/cpp/ripple/LedgerAcquire.cpp b/src/cpp/ripple/LedgerAcquire.cpp index 291ff8f8f..5131c03cf 100644 --- a/src/cpp/ripple/LedgerAcquire.cpp +++ b/src/cpp/ripple/LedgerAcquire.cpp @@ -107,14 +107,17 @@ LedgerAcquire::LedgerAcquire(const uint256& hash, uint32 seq) : PeerSet(hash, LE tryLocal(); } -void LedgerAcquire::checkLocal() +bool LedgerAcquire::checkLocal() { boost::recursive_mutex::scoped_lock sl(mLock); if (isDone()) - return; + return false; - if (tryLocal()) - done(); + if (!tryLocal()) + return false; + + done(); + return true; } bool LedgerAcquire::tryLocal() @@ -1064,13 +1067,20 @@ void LedgerAcquireMaster::gotFetchPack(Job&) acquires.reserve(mLedgers.size()); typedef std::pair u256_acq_pair; BOOST_FOREACH(const u256_acq_pair& it, mLedgers) + { acquires.push_back(it.second); + } } + int completed = 0; BOOST_FOREACH(const LedgerAcquire::pointer& acquire, acquires) { - acquire->checkLocal(); + if (acquire->checkLocal()) + ++completed; } + + if (completed > 0) + theApp->getLedgerMaster().resumeAcquiring(); } // vim:ts=4 diff --git a/src/cpp/ripple/LedgerAcquire.h b/src/cpp/ripple/LedgerAcquire.h index 9e38b0062..7d69f493b 100644 --- a/src/cpp/ripple/LedgerAcquire.h +++ b/src/cpp/ripple/LedgerAcquire.h @@ -130,7 +130,7 @@ public: void addPeers(); void awaitData(); void noAwaitData(); - void checkLocal(); + bool checkLocal(); typedef std::pair neededHash_t; std::vector getNeededHashes(); diff --git a/src/cpp/ripple/NetworkOPs.cpp b/src/cpp/ripple/NetworkOPs.cpp index 4b09dde55..c56c11470 100644 --- a/src/cpp/ripple/NetworkOPs.cpp +++ b/src/cpp/ripple/NetworkOPs.cpp @@ -2121,7 +2121,7 @@ void NetworkOPs::gotFetchPack(bool progress, uint32 seq) mLastFetchPack = 0; mFetchSeq = seq; // earliest pack we have data on theApp->getJobQueue().addJob(jtLEDGER_DATA, "gotFetchPack", - boost::bind(&LedgerAcquireMaster::gotFetchPack, &theApp->getMasterLedgerAcquire(), _1)); + BIND_TYPE(&LedgerAcquireMaster::gotFetchPack, &theApp->getMasterLedgerAcquire(), P_1)); } void NetworkOPs::missingNodeInLedger(uint32 seq) diff --git a/src/cpp/ripple/SHAMap.cpp b/src/cpp/ripple/SHAMap.cpp index 7ac25fe96..834bdef6a 100644 --- a/src/cpp/ripple/SHAMap.cpp +++ b/src/cpp/ripple/SHAMap.cpp @@ -260,7 +260,6 @@ SHAMapTreeNode* SHAMap::getNodePointer(const SHAMapNode& id, const uint256& hash } } - void SHAMap::returnNode(SHAMapTreeNode::pointer& node, bool modify) { // make sure the node is suitable for the intended operation (copy on write) assert(node->isValid()); diff --git a/src/cpp/ripple/SHAMapSync.cpp b/src/cpp/ripple/SHAMapSync.cpp index eb14df863..35fa38f51 100644 --- a/src/cpp/ripple/SHAMapSync.cpp +++ b/src/cpp/ripple/SHAMapSync.cpp @@ -126,7 +126,7 @@ std::vector SHAMap::getNeededHashes(int max, SHAMapSyncFilter* filter) try { d = getNodePointer(childID, childHash, filter); - if (d->isInner() && !d->isFullBelow()) + if (d->isInner()) { have_all = false; stack.push(d);