Allow additional subnet peers (#2823)
## Issue Addressed N/A ## Proposed Changes 1. Don't disconnect peer from dht on connection limit errors 2. Bump up `PRIORITY_PEER_EXCESS` to allow for dialing upto 60 peers by default. Co-authored-by: Diva M <divma@protonmail.com>
This commit is contained in:
parent
2c07a72980
commit
9eedb6b888
@ -959,12 +959,24 @@ impl<TSpec: EthSpec> NetworkBehaviour for Discovery<TSpec> {
|
|||||||
&mut self,
|
&mut self,
|
||||||
peer_id: Option<PeerId>,
|
peer_id: Option<PeerId>,
|
||||||
_handler: Self::ProtocolsHandler,
|
_handler: Self::ProtocolsHandler,
|
||||||
_error: &DialError,
|
error: &DialError,
|
||||||
) {
|
) {
|
||||||
if let Some(peer_id) = peer_id {
|
if let Some(peer_id) = peer_id {
|
||||||
// set peer as disconnected in discovery DHT
|
match error {
|
||||||
debug!(self.log, "Marking peer disconnected in DHT"; "peer_id" => %peer_id);
|
DialError::Banned
|
||||||
self.disconnect_peer(&peer_id);
|
| DialError::LocalPeerId
|
||||||
|
| DialError::InvalidPeerId
|
||||||
|
| DialError::ConnectionIo(_)
|
||||||
|
| DialError::NoAddresses
|
||||||
|
| DialError::Transport(_) => {
|
||||||
|
// set peer as disconnected in discovery DHT
|
||||||
|
debug!(self.log, "Marking peer disconnected in DHT"; "peer_id" => %peer_id);
|
||||||
|
self.disconnect_peer(&peer_id);
|
||||||
|
}
|
||||||
|
DialError::ConnectionLimit(_)
|
||||||
|
| DialError::DialPeerConditionFalse(_)
|
||||||
|
| DialError::Aborted => {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ pub const MIN_OUTBOUND_ONLY_FACTOR: f32 = 0.3;
|
|||||||
/// requiring subnet peers. More specifically, if our target peer limit is 50, and our excess peer
|
/// requiring subnet peers. More specifically, if our target peer limit is 50, and our excess peer
|
||||||
/// limit is 55, and we are at 55 peers, the following parameter provisions a few more slots of
|
/// limit is 55, and we are at 55 peers, the following parameter provisions a few more slots of
|
||||||
/// dialing priority peers we need for validator duties.
|
/// dialing priority peers we need for validator duties.
|
||||||
pub const PRIORITY_PEER_EXCESS: f32 = 0.05;
|
pub const PRIORITY_PEER_EXCESS: f32 = 0.1;
|
||||||
|
|
||||||
/// The main struct that handles peer's reputation and connection status.
|
/// The main struct that handles peer's reputation and connection status.
|
||||||
pub struct PeerManager<TSpec: EthSpec> {
|
pub struct PeerManager<TSpec: EthSpec> {
|
||||||
|
Loading…
Reference in New Issue
Block a user