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 {
4040static const unsigned int MAX_INV_SZ = 50000 ;
4141/* * The maximum number of entries in mapAskFor */
4242static 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 ;
4345
4446inline unsigned int ReceiveFloodSize () { return 1000 *GetArg (" -maxreceivebuffer" , 5 *1000 ); }
4547inline unsigned int SendBufferSize () { return 1000 *GetArg (" -maxsendbuffer" , 1 *1000 ); }
@@ -400,8 +402,13 @@ class CNode
400402 // Known checking here is only to save space from duplicates.
401403 // SendMessages will filter it again for knowns that were added
402404 // 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+ }
405412 }
406413
407414
You can’t perform that action at this time.
0 commit comments