pub fn add_connected(&self, p: Peer) -> Arc<RwLock<Peer>> {
		debug!(LOGGER, "Saving newly connected peer {}.", p.info.addr);
		let peer_data = PeerData {
			addr: p.info.addr,
			capabilities: p.info.capabilities,
			user_agent: p.info.user_agent.clone(),
			flags: State::Healthy,
		};
		if let Err(e) = self.save_peer(&peer_data) {
			error!(LOGGER, "Could not save connected peer: {:?}", e);
		}

		let addr = p.info.addr.clone();
		let apeer = Arc::new(RwLock::new(p));
		{
			let mut peers = self.peers.write().unwrap();
			peers.insert(addr, apeer.clone());
		}
		apeer.clone()
	}
/// 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, p: Peer) -> Arc<RwLock<Peer>> {
		debug!(LOGGER, "Saving newly connected peer {}.", p.info.addr);
		let peer_data = PeerData {
			addr: p.info.addr,
			capabilities: p.info.capabilities,
			user_agent: p.info.user_agent.clone(),
			flags: State::Healthy,
		};
		if let Err(e) = self.save_peer(&peer_data) {
			error!(LOGGER, "Could not save connected peer: {:?}", e);
		}
		let addr = p.info.addr.clone();
		let apeer = Arc::new(RwLock::new(p));
		{
			let mut peers = self.peers.write().unwrap();
			peers.insert(addr, apeer.clone());
		}
		apeer.clone()
	}
pub fn add_connected ( & self , p : Peer ) -> Arc < RwLock < Peer > > { debug ! ( LOGGER " " p info addr ) ; let peer_data = PeerData { addr : p . info . addr , capabilities : p . info . capabilities , user_agent : p . info . user_agent . clone ( ) , flags : State :: Healthy , } ; if let Err ( e ) = self . save_peer ( & peer_data ) { error ! ( LOGGER " " e ) ; } let addr = p . info . addr . clone ( ) ; let apeer = Arc :: new ( RwLock :: new ( p ) ) ; { let mut peers = self . peers . write ( ) . unwrap ( ) ; peers . insert ( addr , apeer . clone ( ) ) ; } apeer . clone ( ) }
Adds the peer to our internal peer mapping.
Adds the peer to our internal peer mapping .
&self
p
Peer