pub fn add_connected(&self, peer: Arc<Peer>) -> Result<(), Error> {
		let peer_data: PeerData;
		let addr: SocketAddr;
		{
			peer_data = PeerData {
				addr: peer.info.addr,
				capabilities: peer.info.capabilities,
				user_agent: peer.info.user_agent.clone(),
				flags: State::Healthy,
				last_banned: 0,
				ban_reason: ReasonForBan::None,
			};
			addr = peer.info.addr.clone();
		}
		debug!(LOGGER, "Saving newly connected peer {}.", addr);
		self.save_peer(&peer_data)?;

		{
			let mut peers = self.peers.write().unwrap();
			peers.insert(addr, peer.clone());
		}
		Ok(())
	}
/// Adds the peer to our internal peer mapping. Note that the peer is still
/// returned so the server can run it.
Adds the peer to our internal peer mapping. Note that the peer is still
returned so the server can run it.
Adds the peer to our internal peer mapping . Note that the peer is still returned so the server can run it .
pub fn add_connected(&self, peer: Arc<Peer>) -> Result<(), Error> {
		let peer_data: PeerData;
		let addr: SocketAddr;
		{
			peer_data = PeerData {
				addr: peer.info.addr,
				capabilities: peer.info.capabilities,
				user_agent: peer.info.user_agent.clone(),
				flags: State::Healthy,
				last_banned: 0,
				ban_reason: ReasonForBan::None,
			};
			addr = peer.info.addr.clone();
		}
		debug!(LOGGER, "Saving newly connected peer {}.", addr);
		self.save_peer(&peer_data)?;
		{
			let mut peers = self.peers.write().unwrap();
			peers.insert(addr, peer.clone());
		}
		Ok(())
	}
pub fn add_connected ( & self , peer : Arc < Peer > ) -> Result < ( ) , Error > { let peer_data : PeerData ; let addr : SocketAddr ; { peer_data = PeerData { addr : peer . info . addr , capabilities : peer . info . capabilities , user_agent : peer . info . user_agent . clone ( ) , flags : State :: Healthy , last_banned : 0 , ban_reason : ReasonForBan :: None , } ; addr = peer . info . addr . clone ( ) ; } debug ! ( LOGGER " " addr ) ; self . save_peer ( & peer_data ) ? ; { let mut peers = self . peers . write ( ) . unwrap ( ) ; peers . insert ( addr , peer . clone ( ) ) ; } Ok ( ( ) ) }
Adds the peer to our internal peer mapping.
Adds the peer to our internal peer mapping .
&self
peer
Arc<Peer>