mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 21:45:52 +00:00
Speed up ledger acquiring.
This commit is contained in:
@@ -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())
|
||||
return false;
|
||||
|
||||
if (tryLocal())
|
||||
done();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LedgerAcquire::tryLocal()
|
||||
@@ -1064,13 +1067,20 @@ void LedgerAcquireMaster::gotFetchPack(Job&)
|
||||
acquires.reserve(mLedgers.size());
|
||||
typedef std::pair<uint256, LedgerAcquire::pointer> 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
|
||||
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
void addPeers();
|
||||
void awaitData();
|
||||
void noAwaitData();
|
||||
void checkLocal();
|
||||
bool checkLocal();
|
||||
|
||||
typedef std::pair<ripple::TMGetObjectByHash::ObjectType, uint256> neededHash_t;
|
||||
std::vector<neededHash_t> getNeededHashes();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -126,7 +126,7 @@ std::vector<uint256> 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);
|
||||
|
||||
Reference in New Issue
Block a user