mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Change how we decide whether to request a fetch pack.
This commit is contained in:
@@ -32,9 +32,7 @@ NetworkOPs::NetworkOPs (LedgerMaster* pLedgerMaster)
|
|||||||
, mLastCloseTime (0)
|
, mLastCloseTime (0)
|
||||||
, mLastValidationTime (0)
|
, mLastValidationTime (0)
|
||||||
, mFetchPack ("FetchPack", 2048, 20)
|
, mFetchPack ("FetchPack", 2048, 20)
|
||||||
, mLastFetchPack (0)
|
, mFetchSeq (0)
|
||||||
// VFALCO TODO Give this magic number a name
|
|
||||||
, mFetchSeq (static_cast <uint32> (-1))
|
|
||||||
, mLastLoadBase (256)
|
, mLastLoadBase (256)
|
||||||
, mLastLoadFactor (256)
|
, mLastLoadFactor (256)
|
||||||
{
|
{
|
||||||
@@ -2351,28 +2349,9 @@ bool NetworkOPs::getFetchPack (uint256 const& hash, Blob& data)
|
|||||||
|
|
||||||
bool NetworkOPs::shouldFetchPack (uint32 seq)
|
bool NetworkOPs::shouldFetchPack (uint32 seq)
|
||||||
{
|
{
|
||||||
uint32 now = getNetworkTimeNC ();
|
if (mFetchSeq == seq);
|
||||||
|
|
||||||
if (mLastFetchPack == now)
|
|
||||||
return false;
|
return false;
|
||||||
|
mFetchSeq = seq;
|
||||||
if (seq < mFetchSeq) // fetch pack has only data for ledgers ahead of where we are
|
|
||||||
mFetchPack.clear ();
|
|
||||||
else
|
|
||||||
mFetchPack.sweep ();
|
|
||||||
|
|
||||||
int size = mFetchPack.getCacheSize ();
|
|
||||||
if (size == 0)
|
|
||||||
{
|
|
||||||
mFetchSeq = 0;
|
|
||||||
}
|
|
||||||
else if (size > 128)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
mLastFetchPack = now;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2383,8 +2362,6 @@ int NetworkOPs::getFetchSize ()
|
|||||||
|
|
||||||
void NetworkOPs::gotFetchPack (bool progress, uint32 seq)
|
void NetworkOPs::gotFetchPack (bool progress, uint32 seq)
|
||||||
{
|
{
|
||||||
mLastFetchPack = 0;
|
|
||||||
mFetchSeq = seq; // earliest pack we have data on
|
|
||||||
getApp().getJobQueue ().addJob (jtLEDGER_DATA, "gotFetchPack",
|
getApp().getJobQueue ().addJob (jtLEDGER_DATA, "gotFetchPack",
|
||||||
BIND_TYPE (&InboundLedgers::gotFetchPack, &getApp().getInboundLedgers (), P_1));
|
BIND_TYPE (&InboundLedgers::gotFetchPack, &getApp().getInboundLedgers (), P_1));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -433,12 +433,6 @@ private:
|
|||||||
SubMapType mSubRTTransactions; // all proposed and accepted transactions
|
SubMapType mSubRTTransactions; // all proposed and accepted transactions
|
||||||
|
|
||||||
TaggedCache< uint256, Blob , UptimeTimerAdapter > mFetchPack;
|
TaggedCache< uint256, Blob , UptimeTimerAdapter > mFetchPack;
|
||||||
uint32 mLastFetchPack;
|
|
||||||
|
|
||||||
// VFALCO TODO Document the special value uint32(-1) for this member
|
|
||||||
// and replace uint32(-1) with a constant. It is initialized
|
|
||||||
// in the ctor-initializer list to this constant.
|
|
||||||
//
|
|
||||||
uint32 mFetchSeq;
|
uint32 mFetchSeq;
|
||||||
|
|
||||||
uint32 mLastLoadBase;
|
uint32 mLastLoadBase;
|
||||||
|
|||||||
Reference in New Issue
Block a user