Cleanups.

This commit is contained in:
JoelKatz
2013-08-12 12:01:55 -07:00
parent f4c6fa7873
commit 1ddf8f3969
4 changed files with 9 additions and 23 deletions

View File

@@ -393,7 +393,7 @@ void LedgerMaster::getFetchPack (Ledger::ref nextLedger)
target->sendPacket (packet, false); target->sendPacket (packet, false);
} }
else else
WriteLog (lsTRACE, LedgerMaster) << "No peer for fetch pack"; WriteLog (lsDEBUG, LedgerMaster) << "No peer for fetch pack";
} }
bool LedgerMaster::shouldAcquire (uint32 currentLedger, uint32 ledgerHistory, uint32 candidateLedger) bool LedgerMaster::shouldAcquire (uint32 currentLedger, uint32 ledgerHistory, uint32 candidateLedger)

View File

@@ -26,25 +26,16 @@ InboundLedger::InboundLedger (uint256 const& hash, uint32 seq)
#ifdef LA_DEBUG #ifdef LA_DEBUG
WriteLog (lsTRACE, InboundLedger) << "Acquiring ledger " << mHash; WriteLog (lsTRACE, InboundLedger) << "Acquiring ledger " << mHash;
#endif #endif
tryLocal (); if (tryLocal ())
done();
} }
// Returns true if progress is made void InboundLedger::checkLocal ()
bool InboundLedger::checkLocal ()
{ {
bool ret = false; boost::recursive_mutex::scoped_lock sl (mLock);
{ if (!isDone () && tryLocal())
boost::recursive_mutex::scoped_lock sl (mLock); done();
if (!isDone () && tryLocal())
{
done();
ret = true;
}
}
return ret;
} }
bool InboundLedger::tryLocal () bool InboundLedger::tryLocal ()

View File

@@ -71,7 +71,7 @@ public:
void addPeers (); void addPeers ();
void awaitData (); void awaitData ();
void noAwaitData (); void noAwaitData ();
bool checkLocal (); void checkLocal ();
typedef std::pair <protocol::TMGetObjectByHash::ObjectType, uint256> neededHash_t; typedef std::pair <protocol::TMGetObjectByHash::ObjectType, uint256> neededHash_t;

View File

@@ -257,15 +257,10 @@ void InboundLedgers::gotFetchPack (Job&)
acquires.push_back (it.second); acquires.push_back (it.second);
} }
bool progress = false;
BOOST_FOREACH (const InboundLedger::pointer & acquire, acquires) BOOST_FOREACH (const InboundLedger::pointer & acquire, acquires)
{ {
if (acquire->checkLocal ()) acquire->checkLocal ();
progress = true;
} }
if (progress)
getApp().getLedgerMaster().tryAdvance();
} }
void InboundLedgers::clearFailures () void InboundLedgers::clearFailures ()