mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
Merge #7856: Only send one GetAddr response per connection.
66b0724
Only send one GetAddr response per connection. (Gregory Maxwell)
This commit is contained in:
parent
b2eabb0974
commit
24f8c248f5
@ -2708,6 +2708,7 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
|
||||
nNextAddrSend = 0;
|
||||
nNextInvSend = 0;
|
||||
fRelayTxes = false;
|
||||
fSentAddr = false;
|
||||
pfilter = new CBloomFilter();
|
||||
nLastBlockTime = 0;
|
||||
nLastTXTime = 0;
|
||||
|
@ -709,6 +709,7 @@ public:
|
||||
// b) the peer may tell us in its version message that we should not relay tx invs
|
||||
// unless it loads a bloom filter.
|
||||
bool fRelayTxes;
|
||||
bool fSentAddr;
|
||||
// If 'true' this node will be disconnected on CMasternodeMan::ProcessMasternodeConnections()
|
||||
bool fMasternode;
|
||||
CSemaphoreGrant grantOutbound;
|
||||
|
@ -1938,6 +1938,14 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
||||
return true;
|
||||
}
|
||||
|
||||
// Only send one GetAddr response per connection to reduce resource waste
|
||||
// and discourage addr stamping of INV announcements.
|
||||
if (pfrom->fSentAddr) {
|
||||
LogPrint("net", "Ignoring repeated \"getaddr\". peer=%d\n", pfrom->id);
|
||||
return true;
|
||||
}
|
||||
pfrom->fSentAddr = true;
|
||||
|
||||
pfrom->vAddrToSend.clear();
|
||||
vector<CAddress> vAddr = connman.GetAddresses();
|
||||
BOOST_FOREACH(const CAddress &addr, vAddr)
|
||||
|
Loading…
Reference in New Issue
Block a user