Skip to content

Commit

Permalink
Limit number of known addresses per peer
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa committed May 30, 2014
1 parent 97ab93f commit 5823449
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/mruset.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ template <typename T> class mruset
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; }
Expand Down
4 changes: 2 additions & 2 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ class CNode

// flood relay
std::vector<CAddress> vAddrToSend;
std::set<CAddress> setAddrKnown;
mruset<CAddress> setAddrKnown;
bool fGetAddr;
std::set<uint256> setKnown;

Expand All @@ -278,7 +278,7 @@ class CNode
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;
Expand Down

0 comments on commit 5823449

Please sign in to comment.