pub fn ban_peer(&self, peer_addr: &SocketAddr, ban_reason: ReasonForBan) {
		if let Err(e) = self.update_state(*peer_addr, State::Banned) {
			error!(LOGGER, "Couldn't ban {}: {:?}", peer_addr, e);
		}

		if let Some(peer) = self.get_connected_peer(peer_addr) {
			debug!(LOGGER, "Banning peer {}", peer_addr);
			// setting peer status will get it removed at the next clean_peer
			peer.send_ban_reason(ban_reason);
			peer.set_banned();
			peer.stop();
		}
	}
/// Ban a peer, disconnecting it if we're currently connected
Ban a peer, disconnecting it if we're currently connected
Ban a peer disconnecting it if we ' re currently connected
pub fn ban_peer(&self, peer_addr: &SocketAddr, ban_reason: ReasonForBan) {
		if let Err(e) = self.update_state(*peer_addr, State::Banned) {
			error!(LOGGER, "Couldn't ban {}: {:?}", peer_addr, e);
		}
		if let Some(peer) = self.get_connected_peer(peer_addr) {
			debug!(LOGGER, "Banning peer {}", peer_addr);
			// setting peer status will get it removed at the next clean_peer
			peer.send_ban_reason(ban_reason);
			peer.set_banned();
			peer.stop();
		}
	}
pub fn ban_peer ( & self , peer_addr : & SocketAddr , ban_reason : ReasonForBan ) { if let Err ( e ) = self . update_state ( * peer_addr , State :: Banned ) { error ! ( LOGGER " " peer_addr e ) ; } if let Some ( peer ) = self . get_connected_peer ( peer_addr ) { debug ! ( LOGGER " " peer_addr ) ; // setting peer status will get it removed at the next clean_peer peer . send_ban_reason ( ban_reason ) ; peer . set_banned ( ) ; peer . stop ( ) ; } }
Ban a peer, disconnecting it if we're currently connected
Ban a peer disconnecting it if we ' re currently connected
&self
peer_addr
&SocketAddr
ban_reason
ReasonForBan