Skip to content

Commit

Permalink
Do not truncate the list of peers for propagation
Browse files Browse the repository at this point in the history
The vector obtained from Topology::view is sorted by node ID,
so truncations make the network biased toward nodes with low IDs.
Let the client connections rotate "naturally", allowing some churn.
A limit on the view size should be implemented in Poldercast:
primetype/poldercast#6
  • Loading branch information
Mikhail Zabaluev committed Feb 6, 2020
1 parent d6e9d58 commit 11bba01
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions jormungandr/src/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,6 @@ fn handle_propagation_msg(
// the item.
send_to_peers.then(move |res| {
if let Err(mut unreached_nodes) = res {
unreached_nodes.truncate(state.config.max_client_connections);
debug!(
state.logger(),
"will try to connect to {} of the peers not immediately reachable for propagation",
Expand Down Expand Up @@ -418,7 +417,6 @@ fn send_gossip(state: GlobalStateR, channels: Channels) -> impl Future<Item = ()
.view(poldercast::Selection::Any)
.and_then(move |view| {
let mut peers = view.peers;
peers.truncate(state.config.max_client_connections);
debug!(logger, "sending gossip to {} peers", peers.len());
stream::iter_ok(peers).for_each(move |node| {
let peer_id = node.id();
Expand Down

0 comments on commit 11bba01

Please sign in to comment.