diff --git a/src/seeder/main.cpp b/src/seeder/main.cpp --- a/src/seeder/main.cpp +++ b/src/seeder/main.cpp @@ -43,7 +43,7 @@ if (ips.empty()) { wait *= 1000; wait += rand() % (500 * *nThreads); - Sleep(wait); + UninterruptibleSleep(std::chrono::milliseconds(wait)); continue; } @@ -242,7 +242,7 @@ int count = 0; do { // First 100s, than 200s, 400s, 800s, 1600s, and then 3200s forever - Sleep(100000 << count); + UninterruptibleSleep(std::chrono::seconds(100 << count)); if (count < 5) { count++; } @@ -319,7 +319,7 @@ stats.nNew, stats.nAvail - stats.nTracked - stats.nNew, stats.nBanned, (unsigned long long)requests, (unsigned long long)queries); - Sleep(1000); + UninterruptibleSleep(1s); } while (1); return nullptr; } @@ -336,7 +336,7 @@ true); } } - Sleep(1800000); + UninterruptibleSleep(30min); } while (1); return nullptr; } @@ -427,7 +427,7 @@ dnsThread.push_back(new CDnsThread(&opts, i)); pthread_create(&threadDns, nullptr, ThreadDNS, dnsThread[i]); tfm::format(std::cout, "."); - Sleep(20); + UninterruptibleSleep(20ms); } tfm::format(std::cout, "done\n"); } diff --git a/src/seeder/util.h b/src/seeder/util.h --- a/src/seeder/util.h +++ b/src/seeder/util.h @@ -5,16 +5,7 @@ #ifndef BITCOIN_SEEDER_UTIL_H #define BITCOIN_SEEDER_UTIL_H -#include - #define BEGIN(a) ((char *)&(a)) #define END(a) ((char *)&((&(a))[1])) -static inline void Sleep(int nMilliSec) { - struct timespec wa; - wa.tv_sec = nMilliSec / 1000; - wa.tv_nsec = (nMilliSec % 1000) * 1000000; - nanosleep(&wa, nullptr); -} - #endif // BITCOIN_SEEDER_UTIL_H