aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-09-10 16:59:31 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-09-10 17:00:37 +0200
commitd030936da2c237a1ff5fb5208b80cf9133b98c15 (patch)
treedc92f9a265fb8f10635bf34a43fca7127fdb4247
parent12927dd315e22b2cc0caa02e9f355c807ea7326a (diff)
downloadbitcoin-d030936da2c237a1ff5fb5208b80cf9133b98c15.tar.xz
Limit CNode::mapAskFor
Tighten resource constraints on CNode. Rebased-From: d4168c8 Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com>
-rw-r--r--src/net.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/net.h b/src/net.h
index f9b953c8da..cb07156bdf 100644
--- a/src/net.h
+++ b/src/net.h
@@ -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); }
@@ -422,6 +424,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_t nRequestTime;