]> Git Repo - VerusCoin.git/commit - src/main.cpp
Replace mruset setAddrKnown with CRollingBloomFilter addrKnown
authorGavin Andresen <[email protected]>
Sat, 25 Apr 2015 20:25:44 +0000 (16:25 -0400)
committerPieter Wuille <[email protected]>
Thu, 30 Apr 2015 15:16:20 +0000 (08:16 -0700)
commitd81cff32e50fe5f686f985d0af2e74219f328ed0
tree4ed441d73f9e62a1d17c69c721e4cae1bd88e1de
parent69a5f8be0abda1e462f8ef44acadd2cbfaa850fb
Replace mruset setAddrKnown with CRollingBloomFilter addrKnown

Use a probabilistic bloom filter to keep track of which addresses
we think we have given our peers, instead of a list.

This uses much less memory, at the cost of sometimes failing to
relay an address to a peer-- worst case if the bloom filter happens
to be as full as it gets, 1-in-1,000.

Measured memory usage of a full mruset setAddrKnown: 650Kbytes
Constant memory usage of CRollingBloomFilter addrKnown: 37Kbytes.

This will also help heap fragmentation, because the 37K of storage
is allocated when a CNode is created (when a connection to a peer
is established) and then there is no per-item-remembered memory
allocation.

I plan on testing by restarting a full node with an empty peers.dat,
running a while with -debug=addrman and -debug=net, and making sure
that the 'addr' message traffic out is reasonable.
(suggestions for better tests welcome)
src/main.cpp
src/net.cpp
src/net.h
This page took 0.025236 seconds and 4 git commands to generate.