Ignore RPC messages of disconnected peers and remove old peers based on disconnection time (#1854)

## Issue Addressed

NA

## Proposed Changes

Lets the networking behavior ignore messages of peers that are not connected. Furthermore, old peers are not removed from the peerdb based on score anymore but based on the disconnection time.
This commit is contained in:
blacktemplar
2020-11-03 23:43:10 +00:00
parent 0a0f4daf9d
commit 7e7fad5734
3 changed files with 26 additions and 13 deletions

View File

@@ -316,6 +316,10 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
self.network_globals.peers.read().is_banned(peer_id)
}
pub fn is_connected(&self, peer_id: &PeerId) -> bool {
self.network_globals.peers.read().is_connected(peer_id)
}
/// Reports whether the peer limit is reached in which case we stop allowing new incoming
/// connections.
pub fn peer_limit_reached(&self) -> bool {