From 5823449e2d7f76fa1f24fed881a8a5041b34b6bf Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Fri, 30 May 2014 12:01:20 +0200 Subject: [PATCH] Limit number of known addresses per peer --- src/mruset.h | 1 + src/net.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mruset.h b/src/mruset.h index c36a0c8f3..c1c08b028 100644 --- a/src/mruset.h +++ b/src/mruset.h @@ -32,6 +32,7 @@ public: bool empty() const { return set.empty(); } iterator find(const key_type& k) const { return set.find(k); } size_type count(const key_type& k) const { return set.count(k); } + void clear() { set.clear(); queue.clear(); } bool inline friend operator==(const mruset& a, const mruset& b) { return a.set == b.set; } bool inline friend operator==(const mruset& a, const std::set& b) { return a.set == b; } bool inline friend operator<(const mruset& a, const mruset& b) { return a.set < b.set; } diff --git a/src/net.h b/src/net.h index ac90ef25e..d3346873b 100644 --- a/src/net.h +++ b/src/net.h @@ -262,7 +262,7 @@ public: // flood relay std::vector vAddrToSend; - std::set setAddrKnown; + mruset setAddrKnown; bool fGetAddr; std::set setKnown; @@ -278,7 +278,7 @@ public: int64_t nPingUsecTime; bool fPingQueued; - CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn = "", bool fInboundIn=false) : ssSend(SER_NETWORK, INIT_PROTO_VERSION) + CNode(SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn = "", bool fInboundIn=false) : ssSend(SER_NETWORK, INIT_PROTO_VERSION), setAddrKnown(5000) { nServices = 0; hSocket = hSocketIn;