diff options
author | Cory Fields <cory-nospam-@coryfields.com> | 2017-05-23 20:48:08 -0400 |
---|---|---|
committer | Cory Fields <cory-nospam-@coryfields.com> | 2017-06-14 18:05:01 -0400 |
commit | 6cdc488e3604267b1e115da5c50ffb970cd30084 (patch) | |
tree | 0724591acf90b7f12a11d10f417cd482a3140eaa /src/net.cpp | |
parent | 6d0bd5b73d14517b349bb07656a18b2acb0d5c45 (diff) |
net: switch to dummy internal ip for dns seed source
This addresss the TODO to avoid resolving twice.
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/net.cpp b/src/net.cpp index e10016d983..0fcf9e0aba 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1604,7 +1604,12 @@ void CConnman::ThreadDNSAddressSeed() std::vector<CNetAddr> vIPs; std::vector<CAddress> vAdd; ServiceFlags requiredServiceBits = nRelevantServices; - if (LookupHost(GetDNSHost(seed, &requiredServiceBits).c_str(), vIPs, 0, true)) + std::string host = GetDNSHost(seed, &requiredServiceBits); + CNetAddr resolveSource; + if (!resolveSource.SetInternal(host)) { + continue; + } + if (LookupHost(host.c_str(), vIPs, 0, true)) { BOOST_FOREACH(const CNetAddr& ip, vIPs) { @@ -1614,18 +1619,7 @@ void CConnman::ThreadDNSAddressSeed() vAdd.push_back(addr); found++; } - } - if (interruptNet) { - return; - } - // TODO: The seed name resolve may fail, yielding an IP of [::], which results in - // addrman assigning the same source to results from different seeds. - // This should switch to a hard-coded stable dummy IP for each seed name, so that the - // resolve is not required at all. - if (!vIPs.empty()) { - CService seedSource; - Lookup(seed.name.c_str(), seedSource, 0, true); - addrman.Add(vAdd, seedSource); + addrman.Add(vAdd, resolveSource); } } } |