From e40b7b9f0be44983324294ddd308d007183cd7f6 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Fri, 29 Mar 2013 10:16:25 -0700 Subject: [PATCH] Stop the acquire engine in cases where it shouldn't run. --- src/cpp/ripple/LedgerMaster.cpp | 4 ++-- src/cpp/ripple/NetworkOPs.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cpp/ripple/LedgerMaster.cpp b/src/cpp/ripple/LedgerMaster.cpp index 9a7ef20742..67381e195e 100644 --- a/src/cpp/ripple/LedgerMaster.cpp +++ b/src/cpp/ripple/LedgerMaster.cpp @@ -248,7 +248,7 @@ bool LedgerMaster::acquireMissingLedger(Ledger::ref origLedger, const uint256& l int timeoutCount; int fetchCount = theApp->getMasterLedgerAcquire().getFetchCount(timeoutCount); - if (fetchCount < fetchMax) + if ((fetchCount < fetchMax) && theApp->getOPs().isFull()) { if (timeoutCount > 2) { @@ -305,7 +305,7 @@ bool LedgerMaster::shouldAcquire(uint32 currentLedger, uint32 ledgerHistory, uin void LedgerMaster::resumeAcquiring() { - if (theApp->getOPs().isNeedNetworkLedger()) + if (!theApp->getOPs().isFull()) return; boost::recursive_mutex::scoped_lock ml(mLock); diff --git a/src/cpp/ripple/NetworkOPs.h b/src/cpp/ripple/NetworkOPs.h index 9cde74eb56..ee656a0612 100644 --- a/src/cpp/ripple/NetworkOPs.h +++ b/src/cpp/ripple/NetworkOPs.h @@ -273,6 +273,7 @@ public: void needNetworkLedger() { mNeedNetworkLedger = true; } void clearNeedNetworkLedger() { mNeedNetworkLedger = false; } bool isNeedNetworkLedger() { return mNeedNetworkLedger; } + bool isFull() { return !mNeedNetworkLedger && (mMode == omFULL); } void setProposing(bool p, bool v) { mProposing = p; mValidating = v; } bool isProposing() { return mProposing; } bool isValidating() { return mValidating; }