aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2020-02-12 01:32:46 +1000
committerAnthony Towns <aj@erisian.com.au>2020-03-17 12:10:47 +1000
commit96954d17948662672cababc940e453dff08e8cbb (patch)
tree5b97adc23e6f87a1354a5fc468487e4e77cc538f /src/net.cpp
parentfa5894f7f581718ea28bb34b52fcd3b33ff3e644 (diff)
DNS seeds: don't query DNS while network is inactive
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 4eb26b095e..b3404a4704 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -1630,8 +1630,14 @@ void CConnman::ThreadDNSAddressSeed()
}
}
- if (interruptNet) {
- return;
+ if (interruptNet) return;
+
+ // hold off on querying seeds if p2p network deactivated
+ if (!fNetworkActive) {
+ LogPrintf("Waiting for network to be reactivated before querying DNS seeds.\n");
+ do {
+ if (!interruptNet.sleep_for(std::chrono::seconds{1})) return;
+ } while (!fNetworkActive);
}
LogPrintf("Loading addresses from DNS seed %s\n", seed);