diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-06-01 09:52:51 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-06-01 09:53:04 +0200 |
commit | cc342a3ede2d26d3124bc94f1645fe2fae040d61 (patch) | |
tree | 6e75c4393bfc0e70299b375f0b350ab9f65febcd | |
parent | 1f6e64228a5631545d4b44e7f15789508203e499 (diff) | |
parent | 5823449e2d7f76fa1f24fed881a8a5041b34b6bf (diff) |
Merge pull request #4257
5823449 Limit number of known addresses per peer (Pieter Wuille)
-rw-r--r-- | src/mruset.h | 1 | ||||
-rw-r--r-- | src/net.h | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/mruset.h b/src/mruset.h index c36a0c8f37..c1c08b0288 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<T>& a, const mruset<T>& b) { return a.set == b.set; } bool inline friend operator==(const mruset<T>& a, const std::set<T>& b) { return a.set == b; } bool inline friend operator<(const mruset<T>& a, const mruset<T>& b) { return a.set < b.set; } @@ -262,7 +262,7 @@ public: // flood relay std::vector<CAddress> vAddrToSend; - std::set<CAddress> setAddrKnown; + mruset<CAddress> setAddrKnown; bool fGetAddr; std::set<uint256> 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; |