Stop the acquire engine in cases where it shouldn't run.

This commit is contained in:
JoelKatz
2013-03-29 10:16:25 -07:00
parent 24bc094cb1
commit e40b7b9f0b
2 changed files with 3 additions and 2 deletions

View File

@@ -248,7 +248,7 @@ bool LedgerMaster::acquireMissingLedger(Ledger::ref origLedger, const uint256& l
int timeoutCount; int timeoutCount;
int fetchCount = theApp->getMasterLedgerAcquire().getFetchCount(timeoutCount); int fetchCount = theApp->getMasterLedgerAcquire().getFetchCount(timeoutCount);
if (fetchCount < fetchMax) if ((fetchCount < fetchMax) && theApp->getOPs().isFull())
{ {
if (timeoutCount > 2) if (timeoutCount > 2)
{ {
@@ -305,7 +305,7 @@ bool LedgerMaster::shouldAcquire(uint32 currentLedger, uint32 ledgerHistory, uin
void LedgerMaster::resumeAcquiring() void LedgerMaster::resumeAcquiring()
{ {
if (theApp->getOPs().isNeedNetworkLedger()) if (!theApp->getOPs().isFull())
return; return;
boost::recursive_mutex::scoped_lock ml(mLock); boost::recursive_mutex::scoped_lock ml(mLock);

View File

@@ -273,6 +273,7 @@ public:
void needNetworkLedger() { mNeedNetworkLedger = true; } void needNetworkLedger() { mNeedNetworkLedger = true; }
void clearNeedNetworkLedger() { mNeedNetworkLedger = false; } void clearNeedNetworkLedger() { mNeedNetworkLedger = false; }
bool isNeedNetworkLedger() { return mNeedNetworkLedger; } bool isNeedNetworkLedger() { return mNeedNetworkLedger; }
bool isFull() { return !mNeedNetworkLedger && (mMode == omFULL); }
void setProposing(bool p, bool v) { mProposing = p; mValidating = v; } void setProposing(bool p, bool v) { mProposing = p; mValidating = v; }
bool isProposing() { return mProposing; } bool isProposing() { return mProposing; }
bool isValidating() { return mValidating; } bool isValidating() { return mValidating; }