As 25 seconds is a timeout for the early exit from dnsseed thread, we could do not introduce a new heuristic constant at all:
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -41,9 +41,9 @@
static_assert(MINIUPNPC_API_VERSION >= 10, "miniUPnPc API version >= 10 assumed");
#endif
-#include <unordered_map>
-
+#include <chrono>
#include <math.h>
+#include <unordered_map>
// Dump addresses to peers.dat every 15 minutes (900s)
static constexpr int DUMP_PEERS_INTERVAL = 15 * 60;
@@ -1601,12 +1601,12 @@ void CConnman::ThreadDNSAddressSeed()
for (const std::string& seed : seeds) {
if (addrman.size() > 0 && seeds_right_now == 0) {
LogPrintf("Waiting %d seconds before querying DNS seeds.\n", seeds_wait_time.count());
- std::chrono::seconds to_wait = seeds_wait_time;
+ std::chrono::milliseconds to_wait{seeds_wait_time};
while (to_wait.count() > 0) {
- std::chrono::seconds w{25}; // check for early abort every 25 seconds
- if (w > to_wait) w = to_wait;
- if (!interruptNet.sleep_for(w)) return;
- to_wait -= w;
+ std::chrono::milliseconds recheck_period{nConnectTimeout};
+ if (recheck_period > to_wait) recheck_period = to_wait;
+ if (!interruptNet.sleep_for(recheck_period)) return;
+ to_wait -= recheck_period;
int nRelevant = 0;
{