fn peerset_report_accept(&mut self, index: substrate_peerset::IncomingIndex) {
		let incoming = if let Some(pos) = self.incoming.iter().position(|i| i.incoming_id == index) {
			self.incoming.remove(pos)
		} else {
			error!(target: "sub-libp2p", "PSM => Accept({:?}): Invalid index", index);
			return
		};

		if !incoming.alive {
			debug!(target: "sub-libp2p", "PSM => Accept({:?}, {:?}): Obsolete incoming,
				sending back dropped", index, incoming.peer_id);
			debug!(target: "sub-libp2p", "PSM <= Dropped({:?})", incoming.peer_id);
			self.peerset.dropped(incoming.peer_id.clone());
			return
		}

		let state = if let Some(state) = self.peers.get_mut(&incoming.peer_id) {
			state
		} else {
			error!(target: "sub-libp2p", "State mismatch in libp2p: no entry in peers \
				corresponding to an alive incoming");
			return
		};

		let connected_point = if let PeerState::Incoming { connected_point } = state {
			connected_point.clone()
		} else {
			error!(target: "sub-libp2p", "State mismatch in libp2p: entry in peers corresponding \
				to an alive incoming is not in incoming state");
			return
		};

		debug!(target: "sub-libp2p", "PSM => Accept({:?}, {:?}): Enabling connection \
			through {:?}", index, incoming.peer_id, connected_point);
		debug!(target: "sub-libp2p", "Handler({:?}) <= Enable", incoming.peer_id);
		self.events.push(NetworkBehaviourAction::SendEvent {
			peer_id: incoming.peer_id,
			event: CustomProtoHandlerIn::Enable(connected_point.clone().into()),
		});

		*state = PeerState::Enabled { open: false, connected_point };
	}
/// Function that is called when the peerset wants us to accept an incoming node.
Function that is called when the peerset wants us to accept an incoming node.
Function that is called when the peerset wants us to accept an incoming node .
fn peerset_report_accept(&mut self, index: substrate_peerset::IncomingIndex) {
		let incoming = if let Some(pos) = self.incoming.iter().position(|i| i.incoming_id == index) {
			self.incoming.remove(pos)
		} else {
			error!(target: "sub-libp2p", "PSM => Accept({:?}): Invalid index", index);
			return
		};
		if !incoming.alive {
			debug!(target: "sub-libp2p", "PSM => Accept({:?}, {:?}): Obsolete incoming,
				sending back dropped", index, incoming.peer_id);
			debug!(target: "sub-libp2p", "PSM <= Dropped({:?})", incoming.peer_id);
			self.peerset.dropped(incoming.peer_id.clone());
			return
		}
		let state = if let Some(state) = self.peers.get_mut(&incoming.peer_id) {
			state
		} else {
			error!(target: "sub-libp2p", "State mismatch in libp2p: no entry in peers \
				corresponding to an alive incoming");
			return
		};
		let connected_point = if let PeerState::Incoming { connected_point } = state {
			connected_point.clone()
		} else {
			error!(target: "sub-libp2p", "State mismatch in libp2p: entry in peers corresponding \
				to an alive incoming is not in incoming state");
			return
		};
		debug!(target: "sub-libp2p", "PSM => Accept({:?}, {:?}): Enabling connection \
			through {:?}", index, incoming.peer_id, connected_point);
		debug!(target: "sub-libp2p", "Handler({:?}) <= Enable", incoming.peer_id);
		self.events.push(NetworkBehaviourAction::SendEvent {
			peer_id: incoming.peer_id,
			event: CustomProtoHandlerIn::Enable(connected_point.clone().into()),
		});
		*state = PeerState::Enabled { open: false, connected_point };
	}
fn peerset_report_accept ( & mut self , index : substrate_peerset :: IncomingIndex ) { let incoming = if let Some ( pos ) = self . incoming . iter ( ) . position ( | i | i . incoming_id == index ) { self . incoming . remove ( pos ) } else { error ! ( target " " " " index ) ; return } ; if ! incoming . alive { debug ! ( target " " " " index incoming peer_id ) ; debug ! ( target " " " " incoming peer_id ) ; self . peerset . dropped ( incoming . peer_id . clone ( ) ) ; return } let state = if let Some ( state ) = self . peers . get_mut ( & incoming . peer_id ) { state } else { error ! ( target " " " \
 " ) ; return } ; let connected_point = if let PeerState :: Incoming { connected_point } = state { connected_point . clone ( ) } else { error ! ( target " " " \
 " ) ; return } ; debug ! ( target " " " \
 " index incoming peer_id connected_point ) ; debug ! ( target " " " " incoming peer_id ) ; self . events . push ( NetworkBehaviourAction :: SendEvent { peer_id : incoming . peer_id , event : CustomProtoHandlerIn :: Enable ( connected_point . clone ( ) . into ( ) ) , } ) ; * state = PeerState :: Enabled { open : false , connected_point } ; }
Function that is called when the peerset wants us to accept an incoming node.
Function that is called when the peerset wants us to accept an incoming node .
&mut self
index
substrate_peerset::IncomingIndex
&mut self
index
substrate_peerset::IncomingIndex