mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 10:22:38 +00:00
do not count dialing peers in the connection limit (#2856)
## Issue Addressed #2841 ## Proposed Changes Not counting dialing peers while deciding if we have reached the target peers in case of outbound peers. ## Additional Info Checked this running in nodes and bandwidth looks normal, peer count looks normal too
This commit is contained in:
@@ -350,8 +350,13 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
|
||||
|
||||
/// Reports whether the peer limit is reached in which case we stop allowing new incoming
|
||||
/// connections.
|
||||
pub fn peer_limit_reached(&self) -> bool {
|
||||
self.network_globals.connected_or_dialing_peers() >= self.max_peers()
|
||||
pub fn peer_limit_reached(&self, count_dialing: bool) -> bool {
|
||||
let max_peers = self.max_peers();
|
||||
if count_dialing {
|
||||
self.network_globals.connected_or_dialing_peers() >= max_peers
|
||||
} else {
|
||||
self.network_globals.connected_peers() >= max_peers
|
||||
}
|
||||
}
|
||||
|
||||
/// Updates `PeerInfo` with `identify` information.
|
||||
|
||||
Reference in New Issue
Block a user