Avoid querying DNS seeds, if we have open connections.

The goal is to increase independence and privacy.

Rebased-From: 2e7009d
This commit is contained in:
Jeff Garzik 2014-07-29 11:04:46 -04:00 committed by Wladimir J. van der Laan
parent 736d8b85b3
commit 026b9dfd6e
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
3 changed files with 15 additions and 1 deletions

View File

@ -52,6 +52,7 @@ Protocol and network code:
- Add a way to limit deserialized string lengths and use it - Add a way to limit deserialized string lengths and use it
- Add a new checkpoint at block 295,000 - Add a new checkpoint at block 295,000
- Increase IsStandard() scriptSig length - Increase IsStandard() scriptSig length
- Avoid querying DNS seeds, if we have open connections
Wallet: Wallet:
- Check redeemScript size does not exceed 520 byte limit - Check redeemScript size does not exceed 520 byte limit

View File

@ -219,7 +219,8 @@ std::string HelpMessage(HelpMessageMode hmm)
strUsage += " -connect=<ip> " + _("Connect only to the specified node(s)") + "\n"; strUsage += " -connect=<ip> " + _("Connect only to the specified node(s)") + "\n";
strUsage += " -discover " + _("Discover own IP address (default: 1 when listening and no -externalip)") + "\n"; strUsage += " -discover " + _("Discover own IP address (default: 1 when listening and no -externalip)") + "\n";
strUsage += " -dns " + _("Allow DNS lookups for -addnode, -seednode and -connect") + " " + _("(default: 1)") + "\n"; strUsage += " -dns " + _("Allow DNS lookups for -addnode, -seednode and -connect") + " " + _("(default: 1)") + "\n";
strUsage += " -dnsseed " + _("Find peers using DNS lookup (default: 1 unless -connect)") + "\n"; strUsage += " -dnsseed " + _("Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect)") + "\n";
strUsage += " -forcednsseed " + _("Always query for peer addresses via DNS lookup (default: 0)") + "\n";
strUsage += " -externalip=<ip> " + _("Specify your own public address") + "\n"; strUsage += " -externalip=<ip> " + _("Specify your own public address") + "\n";
strUsage += " -listen " + _("Accept connections from outside (default: 1 if no -proxy or -connect)") + "\n"; strUsage += " -listen " + _("Accept connections from outside (default: 1 if no -proxy or -connect)") + "\n";
strUsage += " -maxconnections=<n> " + _("Maintain at most <n> connections to peers (default: 125)") + "\n"; strUsage += " -maxconnections=<n> " + _("Maintain at most <n> connections to peers (default: 125)") + "\n";

View File

@ -1166,6 +1166,18 @@ void MapPort(bool)
void ThreadDNSAddressSeed() void ThreadDNSAddressSeed()
{ {
// goal: only query DNS seeds if address need is acute
if ((addrman.size() > 0) &&
(!GetBoolArg("-forcednsseed", false))) {
MilliSleep(11 * 1000);
LOCK(cs_vNodes);
if (vNodes.size() >= 2) {
LogPrintf("P2P peers available. Skipped DNS seeding.\n");
return;
}
}
const vector<CDNSSeedData> &vSeeds = Params().DNSSeeds(); const vector<CDNSSeedData> &vSeeds = Params().DNSSeeds();
int found = 0; int found = 0;