Skip to content

Commit

Permalink
fix(network): clients should not perform farthest relevant record check
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandSherwin authored and joshuef committed Apr 5, 2024
1 parent 06fc983 commit 131efe1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions sn_networking/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -602,14 +602,15 @@ impl SwarmDriver {
}
}
_ = set_farthest_record_interval.tick() => {
let closest_k_peers = self
.get_closest_k_value_local_peers();

if let Some(distance) = self.get_farthest_relevant_address_estimate(&closest_k_peers) {
// set any new distance to fathest record in the store
self.swarm.behaviour_mut().kademlia.store_mut().set_distance_range(distance);
// the distance range within the replication_fetcher shall be in sync as well
self.replication_fetcher.set_distance_range(distance);
if !self.is_client {
let closest_k_peers = self.get_closest_k_value_local_peers();

if let Some(distance) = self.get_farthest_relevant_address_estimate(&closest_k_peers) {
// set any new distance to farthest record in the store
self.swarm.behaviour_mut().kademlia.store_mut().set_distance_range(distance);
// the distance range within the replication_fetcher shall be in sync as well
self.replication_fetcher.set_distance_range(distance);
}
}
}
}
Expand Down

0 comments on commit 131efe1

Please sign in to comment.