Some cleanups.

This commit is contained in:
JoelKatz
2013-08-11 22:57:57 -07:00
parent 8b06891663
commit fbfb150cff
3 changed files with 8 additions and 5 deletions

View File

@@ -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;

View File

@@ -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]);
}

View File

@@ -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)