From 96954d17948662672cababc940e453dff08e8cbb Mon Sep 17 00:00:00 2001 From: Anthony Towns Date: Wed, 12 Feb 2020 01:32:46 +1000 Subject: [PATCH] DNS seeds: don't query DNS while network is inactive --- src/net.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index 4eb26b095e7..b3404a4704c 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);