Reduce outgoing peers demand (#2969)
* reduce demand * use `saturating_sub`
This commit is contained in:
parent
6b39edc74b
commit
07610feef3
|
@ -199,8 +199,12 @@ where
|
||||||
);
|
);
|
||||||
let _ = candidates.update_initial(active_initial_peer_count).await;
|
let _ = candidates.update_initial(active_initial_peer_count).await;
|
||||||
|
|
||||||
// TODO: reduce demand by `active_outbound_connections.update_count()` (#2902)
|
// Compute remaining connections to open.
|
||||||
for _ in 0..config.peerset_initial_target_size {
|
let demand_count = config
|
||||||
|
.peerset_initial_target_size
|
||||||
|
.saturating_sub(active_outbound_connections.update_count());
|
||||||
|
|
||||||
|
for _ in 0..demand_count {
|
||||||
let _ = demand_tx.try_send(MorePeers);
|
let _ = demand_tx.try_send(MorePeers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue