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

View File

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

View File

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

View File

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