Skip to content

Commit

Permalink
Limit CNode::mapAskFor
Browse files Browse the repository at this point in the history
Tighten resource constraints on CNode.

Rebased-From: d4168c8
Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com>
  • Loading branch information
laanwj authored and michilumin committed Sep 22, 2014
1 parent d6a5e74 commit 4ada10a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ namespace boost {

/** 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); }
Expand Down Expand Up @@ -422,6 +424,9 @@ class CNode

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_t nRequestTime;
Expand Down

0 comments on commit 4ada10a

Please sign in to comment.