File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ namespace boost {
40
40
static const unsigned int MAX_INV_SZ = 50000 ;
41
41
/* * The maximum number of entries in mapAskFor */
42
42
static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
43
+ /* * The maximum number of new addresses to accumulate before announcing. */
44
+ static const unsigned int MAX_ADDR_TO_SEND = 1000 ;
43
45
44
46
inline unsigned int ReceiveFloodSize () { return 1000 *GetArg (" -maxreceivebuffer" , 5 *1000 ); }
45
47
inline unsigned int SendBufferSize () { return 1000 *GetArg (" -maxsendbuffer" , 1 *1000 ); }
@@ -400,8 +402,13 @@ class CNode
400
402
// Known checking here is only to save space from duplicates.
401
403
// SendMessages will filter it again for knowns that were added
402
404
// after addresses were pushed.
403
- if (addr.IsValid () && !setAddrKnown.count (addr))
404
- vAddrToSend.push_back (addr);
405
+ if (addr.IsValid () && !setAddrKnown.count (addr)) {
406
+ if (vAddrToSend.size () >= MAX_ADDR_TO_SEND) {
407
+ vAddrToSend[insecure_rand () % vAddrToSend.size ()] = addr;
408
+ } else {
409
+ vAddrToSend.push_back (addr);
410
+ }
411
+ }
405
412
}
406
413
407
414
You can’t perform that action at this time.
0 commit comments