diff options
author | Gregory Maxwell <greg@xiph.org> | 2016-04-11 01:09:34 +0000 |
---|---|---|
committer | Gregory Maxwell <greg@xiph.org> | 2016-04-11 01:09:34 +0000 |
commit | 66b07247a7a9e48e082502338176cc06edf61474 (patch) | |
tree | 3ebcc514aeed59dcb78829228b29bc3ded4757bc /src/main.cpp | |
parent | 065c6b443f3e9864b1b4231208b49e3cef99cef3 (diff) |
Only send one GetAddr response per connection.
This conserves resources from abusive peers that just send
getaddr in a loop. Also makes correlating addr messages
against INVs less effective.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index f5c7e11d6e..df494b226d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5214,6 +5214,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 = addrman.GetAddr(); BOOST_FOREACH(const CAddress &addr, vAddr) |