Limit CNode::mapAskFor
Tighten resource constraints on CNode. Rebased-From: d4168c82bef0d86fd254a9d993906a09f5fd7fc0 for 0.8
This commit is contained in:
parent
826cd8b909
commit
4f7e47a64e
@ -39,8 +39,6 @@ static const unsigned int MAX_STANDARD_TX_SIZE = 100000;
|
||||
static const unsigned int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;
|
||||
/** The maximum number of orphan transactions kept in memory */
|
||||
static const unsigned int MAX_ORPHAN_TRANSACTIONS = MAX_BLOCK_SIZE/100;
|
||||
/** The maximum number of entries in an 'inv' protocol message */
|
||||
static const unsigned int MAX_INV_SZ = 50000;
|
||||
/** The maximum size of a blk?????.dat file (since 0.8) */
|
||||
static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB
|
||||
/** The pre-allocation chunk size for blk?????.dat files (since 0.8) */
|
||||
|
||||
@ -27,6 +27,10 @@ class CBlockIndex;
|
||||
extern int nBestHeight;
|
||||
|
||||
|
||||
/** The maximum number of entries in an 'inv' protocol message */
|
||||
static const unsigned int MAX_INV_SZ = 50000;
|
||||
/** The maximum number of entries in mapAskFor */
|
||||
static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
|
||||
|
||||
inline unsigned int ReceiveFloodSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }
|
||||
inline unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }
|
||||
@ -357,6 +361,9 @@ public:
|
||||
|
||||
void AskFor(const CInv& inv)
|
||||
{
|
||||
if (mapAskFor.size() > MAPASKFOR_MAX_SZ)
|
||||
return;
|
||||
|
||||
// We're using mapAskFor as a priority queue,
|
||||
// the key is the earliest time the request can be sent
|
||||
int64 nRequestTime;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user