Cleanups and timing adjustments.

This commit is contained in:
JoelKatz
2013-01-28 02:32:57 -08:00
parent 635aa35d49
commit 0cb1a1d84b
2 changed files with 8 additions and 3 deletions

View File

@@ -14,7 +14,9 @@ SETUP_LOG();
DECLARE_INSTANCE(LedgerAcquire); DECLARE_INSTANCE(LedgerAcquire);
#define LA_DEBUG #define LA_DEBUG
#define LEDGER_ACQUIRE_TIMEOUT 750 #define LEDGER_ACQUIRE_TIMEOUT 750 // millisecond for each ledger timeout
#define LEDGER_TIMEOUT_COUNT 10 // how many timeouts before we giveup
#define LEDGER_TIMEOUT_AGGRESSIVE 4 // how many timeouts before we get aggressive
#define TRUST_NETWORK #define TRUST_NETWORK
PeerSet::PeerSet(const uint256& hash, int interval) : mHash(hash), mTimerInterval(interval), mTimeouts(0), PeerSet::PeerSet(const uint256& hash, int interval) : mHash(hash), mTimerInterval(interval), mTimeouts(0),
@@ -165,7 +167,7 @@ bool LedgerAcquire::tryLocal()
void LedgerAcquire::onTimer(bool progress) void LedgerAcquire::onTimer(bool progress)
{ {
if (getTimeouts() > 6) if (getTimeouts() > LEDGER_TIMEOUT_COUNT)
{ {
cLog(lsWARNING) << "Six timeouts for ledger " << mHash; cLog(lsWARNING) << "Six timeouts for ledger " << mHash;
setFailed(); setFailed();
@@ -301,7 +303,7 @@ void LedgerAcquire::trigger(Peer::ref peer)
{ {
tmGL.set_querytype(ripple::qtINDIRECT); tmGL.set_querytype(ripple::qtINDIRECT);
if (!isProgress() && !mFailed && mByHash && (getTimeouts() > 2)) if (!isProgress() && !mFailed && mByHash && (getTimeouts() > LEDGER_TIMEOUT_AGGRESSIVE))
{ {
std::vector<neededHash_t> need = getNeededHashes(); std::vector<neededHash_t> need = getNeededHashes();
if (!need.empty()) if (!need.empty())

View File

@@ -1176,7 +1176,10 @@ void Peer::recvGetObjectByHash(ripple::TMGetObjectByHash& packet)
punishPeer(LT_BadData); punishPeer(LT_BadData);
} }
else else
{
cLog(lsDEBUG) << "Got wanted hash " << hash;
theApp->getHashedObjectStore().store(type, seq, data, hash); theApp->getHashedObjectStore().store(type, seq, data, hash);
}
} }
else else
cLog(lsWARNING) << "Received unwanted hash " << getIP() << " " << hash; cLog(lsWARNING) << "Received unwanted hash " << getIP() << " " << hash;