Skip to content
Snippets Groups Projects
Commit e601f4f0 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

dht: add max bootstrap period

parent 18362064
Branches bootstrap
No related tags found
No related merge requests found
...@@ -43,6 +43,7 @@ constexpr duration Dht::LISTEN_EXPIRE_TIME; ...@@ -43,6 +43,7 @@ constexpr duration Dht::LISTEN_EXPIRE_TIME;
constexpr duration Dht::LISTEN_EXPIRE_TIME_PUBLIC; constexpr duration Dht::LISTEN_EXPIRE_TIME_PUBLIC;
constexpr duration Dht::REANNOUNCE_MARGIN; constexpr duration Dht::REANNOUNCE_MARGIN;
static constexpr size_t MAX_REQUESTS_PER_SEC {8 * 1024}; static constexpr size_t MAX_REQUESTS_PER_SEC {8 * 1024};
static constexpr duration BOOTSTRAP_PERIOD_MAX {std::chrono::hours(24)};
NodeStatus NodeStatus
Dht::updateStatus(sa_family_t af) Dht::updateStatus(sa_family_t af)
...@@ -2058,7 +2059,7 @@ Dht::bootstrap() ...@@ -2058,7 +2059,7 @@ Dht::bootstrap()
if (bootstrapJob) if (bootstrapJob)
bootstrapJob->cancel(); bootstrapJob->cancel();
bootstrapJob = scheduler.add(scheduler.time() + bootstrap_period, std::bind(&Dht::bootstrap, this)); 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 void
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment