Skip to content

Commit

Permalink
fix peers counting in routing table
Browse files Browse the repository at this point in the history
  • Loading branch information
stormshield-frb committed Jun 19, 2024
1 parent 8d1d127 commit 7268d7e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion protocols/kad/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,12 @@ where
/// table is currently small (less that `K_VALUE` peers are present) and only
/// trigger a bootstrap in that case
fn bootstrap_on_low_peers(&mut self) {
if self.kbuckets().count() < K_VALUE.get() {
if self
.kbuckets()
.map(|kbucket| kbucket.num_entries())
.sum::<usize>()
< K_VALUE.get()
{
self.bootstrap_status.trigger();
}
}
Expand Down

0 comments on commit 7268d7e

Please sign in to comment.