Introduce -maxuploadtarget
* -maxuploadtarget can be set in MiB * if <limit> - ( time-left-in-24h-cycle / 600 * MAX_BLOCK_SIZE ) has reach, stop serve blocks older than one week and filtered blocks * no action if limit has reached, no guarantee that the target will not be surpassed * add outbound limit informations to rpc getnettotals
This commit is contained in:
committed by
Jonas Schnelli
parent
867d6c90b8
commit
872fee3fcc
27
src/net.h
27
src/net.h
@@ -400,6 +400,12 @@ private:
|
||||
static uint64_t nTotalBytesRecv;
|
||||
static uint64_t nTotalBytesSent;
|
||||
|
||||
// outbound limit & stats
|
||||
static uint64_t nMaxOutboundTotalBytesSentInCycle;
|
||||
static uint64_t nMaxOutboundCycleStartTime;
|
||||
static uint64_t nMaxOutboundLimit;
|
||||
static uint64_t nMaxOutboundTimeframe;
|
||||
|
||||
CNode(const CNode&);
|
||||
void operator=(const CNode&);
|
||||
|
||||
@@ -701,6 +707,27 @@ public:
|
||||
|
||||
static uint64_t GetTotalBytesRecv();
|
||||
static uint64_t GetTotalBytesSent();
|
||||
|
||||
//!set the max outbound target in bytes
|
||||
static void SetMaxOutboundTarget(uint64_t limit);
|
||||
static uint64_t GetMaxOutboundTarget();
|
||||
|
||||
//!set the timeframe for the max outbound target
|
||||
static void SetMaxOutboundTimeframe(uint64_t timeframe);
|
||||
static uint64_t GetMaxOutboundTimeframe();
|
||||
|
||||
//!check if the outbound target is reached
|
||||
// if param historicalBlockServingLimit is set true, the function will
|
||||
// response true if the limit for serving historical blocks has been reached
|
||||
static bool OutboundTargetReached(bool historicalBlockServingLimit);
|
||||
|
||||
//!response the bytes left in the current max outbound cycle
|
||||
// in case of no limit, it will always response 0
|
||||
static uint64_t GetOutboundTargetBytesLeft();
|
||||
|
||||
//!response the time in second left in the current max outbound cycle
|
||||
// in case of no limit, it will always response 0
|
||||
static uint64_t GetMaxOutboundTimeLeftInCycle();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user