mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Some cleanups.
This commit is contained in:
@@ -557,16 +557,19 @@ void LedgerMaster::advanceThread()
|
||||
Ledger::pointer ledger = getLedgerByHash(nextLedger->getParentHash());
|
||||
if (!ledger)
|
||||
{
|
||||
if (getApp().getOPs().shouldFetchPack(missing) && (missing > 40000))
|
||||
getFetchPack(nextLedger);
|
||||
if (!getApp().getInboundLedgers().isFailure(nextLedger->getParentHash()))
|
||||
{
|
||||
sl.unlock();
|
||||
|
||||
if (getApp().getOPs().shouldFetchPack(missing) && (missing > 40000))
|
||||
getFetchPack(nextLedger);
|
||||
|
||||
InboundLedger::pointer acq =
|
||||
getApp().getInboundLedgers().findCreate(nextLedger->getParentHash(),
|
||||
nextLedger->getLedgerSeq() - 1);
|
||||
if (acq && acq->isComplete() && !acq->isFailed())
|
||||
ledger = acq->getLedger();
|
||||
|
||||
sl.lock();
|
||||
if (mValidLedger->getLedgerSeq() != mPubLedger->getLedgerSeq())
|
||||
progress = true;
|
||||
|
||||
@@ -210,7 +210,7 @@ void InboundLedger::addPeers ()
|
||||
return;
|
||||
|
||||
// We traverse the peer list in random order so as not to favor any particular peer
|
||||
int firstPeer = rand () & vSize;
|
||||
int firstPeer = rand () % vSize;
|
||||
|
||||
int found = 0;
|
||||
|
||||
@@ -228,7 +228,7 @@ void InboundLedger::addPeers ()
|
||||
}
|
||||
|
||||
if (!found)
|
||||
for (int i = 0; i < vSize; ++i)
|
||||
for (int i = 0; i < ((vSize > 3) ? 3 : vSize); ++i)
|
||||
peerHas (peerList[ (i + firstPeer) % vSize]);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class InboundLedgers : LeakChecked <InboundLedger>
|
||||
{
|
||||
public:
|
||||
// How long before we try again to acquire the same ledger
|
||||
static const int kReacquireIntervalSeconds = 600;
|
||||
static const int kReacquireIntervalSeconds = 300;
|
||||
|
||||
InboundLedgers ()
|
||||
: mRecentFailures ("LedgerAcquireRecentFailures", 0, kReacquireIntervalSeconds)
|
||||
|
||||
Reference in New Issue
Block a user