Skip to content

Commit 96954d1

Browse files
committed
DNS seeds: don't query DNS while network is inactive
1 parent fa5894f commit 96954d1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/net.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,8 +1630,14 @@ void CConnman::ThreadDNSAddressSeed()
16301630
}
16311631
}
16321632

1633-
if (interruptNet) {
1634-
return;
1633+
if (interruptNet) return;
1634+
1635+
// hold off on querying seeds if p2p network deactivated
1636+
if (!fNetworkActive) {
1637+
LogPrintf("Waiting for network to be reactivated before querying DNS seeds.\n");
1638+
do {
1639+
if (!interruptNet.sleep_for(std::chrono::seconds{1})) return;
1640+
} while (!fNetworkActive);
16351641
}
16361642

16371643
LogPrintf("Loading addresses from DNS seed %s\n", seed);

0 commit comments

Comments
 (0)