Fix pathfinding aggressiveness logic.

This commit is contained in:
David Schwartz
2013-08-20 10:51:38 -07:00
parent beb50496a4
commit a2f90da10c
2 changed files with 11 additions and 10 deletions

View File

@@ -680,7 +680,6 @@ void LedgerMaster::advanceThread()
getApp().getOPs().clearNeedNetworkLedger(); getApp().getOPs().clearNeedNetworkLedger();
mPathFindNewLedger = true;
if (!mPathFindThread) if (!mPathFindThread)
{ {
mPathFindThread = true; mPathFindThread = true;
@@ -832,26 +831,28 @@ void LedgerMaster::updatePaths ()
do do
{ {
bool newOnly = false; bool newOnly = true;
{ {
boost::recursive_mutex::scoped_lock ml (mLock); boost::recursive_mutex::scoped_lock ml (mLock);
if (mPathFindNewLedger || (lastLedger && (lastLedger.get () != mPubLedger.get ()))) if (!mPathLedger || (mPathLedger->getLedgerSeq() < mValidLedger->getLedgerSeq()))
lastLedger = mPubLedger; { // We have a new valid ledger since the last full pathfinding
newOnly = false;
mPathLedger = mValidLedger;
lastLedger = mPathLedger;
}
else if (mPathFindNewRequest) else if (mPathFindNewRequest)
{ { // We have a new request but no new ledger
newOnly = true; newOnly = true;
lastLedger = boost::make_shared<Ledger> (boost::ref (*mCurrentLedger), false); lastLedger = boost::make_shared<Ledger> (boost::ref (*mCurrentLedger), false);
} }
else else
{ { // Nothing to do
mPathFindThread = false; mPathFindThread = false;
return; return;
} }
lastLedger = mPubLedger;
mPathFindNewLedger = false;
mPathFindNewRequest = false; mPathFindNewRequest = false;
} }

View File

@@ -27,7 +27,6 @@ public:
, mAdvanceThread (false) , mAdvanceThread (false)
, mFillInProgress (false) , mFillInProgress (false)
, mPathFindThread (false) , mPathFindThread (false)
, mPathFindNewLedger (false)
, mPathFindNewRequest (false) , mPathFindNewRequest (false)
{ {
} }
@@ -206,6 +205,7 @@ private:
Ledger::pointer mClosedLedger; // The ledger that most recently closed Ledger::pointer mClosedLedger; // The ledger that most recently closed
Ledger::pointer mValidLedger; // The highest-sequence ledger we have fully accepted Ledger::pointer mValidLedger; // The highest-sequence ledger we have fully accepted
Ledger::pointer mPubLedger; // The last ledger we have published Ledger::pointer mPubLedger; // The last ledger we have published
Ledger::pointer mPathLedger; // The last ledger we did pathfinding against
LedgerHistory mLedgerHistory; LedgerHistory mLedgerHistory;