fn peer_connection_up(&self, peer_id: NodeId) {
        self.metrics.connection_up_events.inc();
        let _now = SystemTime::now();

        let last_disconnect = self
            .current_peers
            .lock()
            .unwrap()
            .get_mut(&peer_id)
            .and_then(|res| res.disconnect_time);
        match last_disconnect {
            Some(last_disconnect) => {
                match last_disconnect.elapsed() {
                    Ok(elapsed) => {
                        trace!(
                            self.log,
                            "Disconnect to peer {:?} for {:?} seconds",
                            peer_id,
                            elapsed
                        );

                        // Clear the send queues and send re-transmission request to the peer on
                        // connect.
                        self.transport
                            .clear_send_queues(self.transport_client_type, &peer_id);
                    }
                    Err(e) => {
                        warn!(self.log, "Error in elapsed time calculation: {:?}", e);
                    }
                }
            }
            None => {
                trace!(
                    self.log,
                    "No previous disconnect event recorded in peer manager for node : {:?}",
                    peer_id
                );
            }
        }
        self.send_retransmission_request(peer_id);
    }
/// The method reacts to a connect event event for the peer with the given
/// node ID.
The method reacts to a connect event event for the peer with the given
node ID.
The method reacts to a connect event event for the peer with the given node ID .
fn peer_connection_up(&self, peer_id: NodeId) {
        self.metrics.connection_up_events.inc();
        let _now = SystemTime::now();
        let last_disconnect = self
            .current_peers
            .lock()
            .unwrap()
            .get_mut(&peer_id)
            .and_then(|res| res.disconnect_time);
        match last_disconnect {
            Some(last_disconnect) => {
                match last_disconnect.elapsed() {
                    Ok(elapsed) => {
                        trace!(
                            self.log,
                            "Disconnect to peer {:?} for {:?} seconds",
                            peer_id,
                            elapsed
                        );
                        // Clear the send queues and send re-transmission request to the peer on
                        // connect.
                        self.transport
                            .clear_send_queues(self.transport_client_type, &peer_id);
                    }
                    Err(e) => {
                        warn!(self.log, "Error in elapsed time calculation: {:?}", e);
                    }
                }
            }
            None => {
                trace!(
                    self.log,
                    "No previous disconnect event recorded in peer manager for node : {:?}",
                    peer_id
                );
            }
        }
        self.send_retransmission_request(peer_id);
    }
fn peer_connection_up ( & self , peer_id : NodeId ) { self . metrics . connection_up_events . inc ( ) ; let _now = SystemTime :: now ( ) ; let last_disconnect = self . current_peers . lock ( ) . unwrap ( ) . get_mut ( & peer_id ) . and_then ( | res | res . disconnect_time ) ; match last_disconnect { Some ( last_disconnect ) => { match last_disconnect . elapsed ( ) { Ok ( elapsed ) => { trace ! ( self log " " peer_id elapsed ) ; // Clear the send queues and send re-transmission request to the peer on // connect. self . transport . clear_send_queues ( self . transport_client_type , & peer_id ) ; } Err ( e ) => { warn ! ( self log " " e ) ; } } } None => { trace ! ( self log " " peer_id ) ; } } self . send_retransmission_request ( peer_id ) ; }
The method reacts to a connect event event for the peer with the given
node ID.
The method reacts to a connect event event for the peer with the given node ID .
&self
peer_id
NodeId
&self
peer_id
NodeId