aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-09-09 09:18:05 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-09-09 09:19:15 +0200
commitd4168c82bef0d86fd254a9d993906a09f5fd7fc0 (patch)
treeebcbbf5dc4117af40c5c52fd74526865d093754c /src
parent8bc0a0173e885a5b60e12d3769604236967c262e (diff)
downloadbitcoin-d4168c82bef0d86fd254a9d993906a09f5fd7fc0.tar.xz
Limit CNode::mapAskFor
Tighten resource constraints on CNode.
Diffstat (limited to 'src')
-rw-r--r--src/net.cpp2
-rw-r--r--src/net.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 2546826f9a..6b7e62d7cb 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2106,6 +2106,8 @@ CNode::~CNode()
void CNode::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;
diff --git a/src/net.h b/src/net.h
index e2700c0975..ad0a1df7e2 100644
--- a/src/net.h
+++ b/src/net.h
@@ -51,6 +51,8 @@ static const bool DEFAULT_UPNP = USE_UPNP;
#else
static const bool DEFAULT_UPNP = false;
#endif
+/** The maximum number of entries in mapAskFor */
+static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
unsigned int ReceiveFloodSize();
unsigned int SendBufferSize();