Skip to content

Commit

Permalink
Merge pull request #4559
Browse files Browse the repository at this point in the history
2e7009d Avoid querying DNS seeds, if we have open connections. (Jeff Garzik)
  • Loading branch information
laanwj committed Jul 29, 2014
2 parents 2920322 + 2e7009d commit 4ad23d2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ std::string HelpMessage(HelpMessageMode mode)
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 += " -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 += " -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";
Expand Down
12 changes: 12 additions & 0 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1221,6 +1221,18 @@ void MapPort(bool)

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();
int found = 0;

Expand Down

0 comments on commit 4ad23d2

Please sign in to comment.