From e601f4f081e6096d6a9afe232cf7eeeebd140002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= <adrien.beraud@savoirfairelinux.com> Date: Sat, 19 Feb 2022 00:52:13 -0500 Subject: [PATCH] dht: add max bootstrap period --- src/dht.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dht.cpp b/src/dht.cpp index b7e455e2..74c563b2 100644 --- a/src/dht.cpp +++ b/src/dht.cpp @@ -43,6 +43,7 @@ constexpr duration Dht::LISTEN_EXPIRE_TIME; constexpr duration Dht::LISTEN_EXPIRE_TIME_PUBLIC; constexpr duration Dht::REANNOUNCE_MARGIN; static constexpr size_t MAX_REQUESTS_PER_SEC {8 * 1024}; +static constexpr duration BOOTSTRAP_PERIOD_MAX {std::chrono::hours(24)}; NodeStatus Dht::updateStatus(sa_family_t af) @@ -2058,7 +2059,7 @@ Dht::bootstrap() if (bootstrapJob) bootstrapJob->cancel(); bootstrapJob = scheduler.add(scheduler.time() + bootstrap_period, std::bind(&Dht::bootstrap, this)); - bootstrap_period *= 2; + bootstrap_period = std::min(bootstrap_period * 2, BOOTSTRAP_PERIOD_MAX); } void -- GitLab