pub(crate) fn handle_connection_drop(
        &mut self,
        addr: SocketAddr,
        now: Instant,
    ) -> Option<DialRequest<H>> {
        let span = make_span(addr, self.outgoing.get(&addr));

        span.clone().in_scope(move || {
            if let Some(outgoing) = self.outgoing.get(&addr) {
                match outgoing.state {
                    OutgoingState::Waiting { .. }
                    | OutgoingState::Loopback
                    | OutgoingState::Connecting { .. } => {
                        // We should, under normal circumstances, not receive drop notifications for
                        // any of these. Connection failures are handled by the dialer.
                        warn!("unexpected drop notification");
                        None
                    }
                    OutgoingState::Connected { .. } => {
                        // Drop the handle, immediately initiate a reconnection.
                        self.change_outgoing_state(
                            addr,
                            OutgoingState::Connecting {
                                failures_so_far: 0,
                                since: now,
                            },
                        );
                        Some(DialRequest::Dial { addr, span })
                    }
                    OutgoingState::Blocked { .. } => {
                        // Blocked addresses ignore connection drops.
                        debug!("received drop notification for blocked connection");
                        None
                    }
                }
            } else {
                warn!("received connection drop notification for unknown connection");
                None
            }
        })
    }
/// Notifies the connection manager about a dropped connection.
///
/// This will usually result in an immediate reconnection.
Notifies the connection manager about a dropped connection.
This will usually result in an immediate reconnection.
Notifies the connection manager about a dropped connection . This will usually result in an immediate reconnection .
pub(crate) fn handle_connection_drop(
        &mut self,
        addr: SocketAddr,
        now: Instant,
    ) -> Option<DialRequest<H>> {
        let span = make_span(addr, self.outgoing.get(&addr));
        span.clone().in_scope(move || {
            if let Some(outgoing) = self.outgoing.get(&addr) {
                match outgoing.state {
                    OutgoingState::Waiting { .. }
                    | OutgoingState::Loopback
                    | OutgoingState::Connecting { .. } => {
                        // We should, under normal circumstances, not receive drop notifications for
                        // any of these. Connection failures are handled by the dialer.
                        warn!("unexpected drop notification");
                        None
                    }
                    OutgoingState::Connected { .. } => {
                        // Drop the handle, immediately initiate a reconnection.
                        self.change_outgoing_state(
                            addr,
                            OutgoingState::Connecting {
                                failures_so_far: 0,
                                since: now,
                            },
                        );
                        Some(DialRequest::Dial { addr, span })
                    }
                    OutgoingState::Blocked { .. } => {
                        // Blocked addresses ignore connection drops.
                        debug!("received drop notification for blocked connection");
                        None
                    }
                }
            } else {
                warn!("received connection drop notification for unknown connection");
                None
            }
        })
    }
pub ( crate ) fn handle_connection_drop ( & mut self , addr : SocketAddr , now : Instant , ) -> Option < DialRequest < H > > { let span = make_span ( addr , self . outgoing . get ( & addr ) ) ; span . clone ( ) . in_scope ( move | | { if let Some ( outgoing ) = self . outgoing . get ( & addr ) { match outgoing . state { OutgoingState :: Waiting { .. } | OutgoingState :: Loopback | OutgoingState :: Connecting { .. } => { // We should, under normal circumstances, not receive drop notifications for // any of these. Connection failures are handled by the dialer. warn ! ( " " ) ; None } OutgoingState :: Connected { .. } => { // Drop the handle, immediately initiate a reconnection. self . change_outgoing_state ( addr , OutgoingState :: Connecting { failures_so_far : 0 , since : now , } , ) ; Some ( DialRequest :: Dial { addr , span } ) } OutgoingState :: Blocked { .. } => { // Blocked addresses ignore connection drops. debug ! ( " " ) ; None } } } else { warn ! ( " " ) ; None } } ) }
Notifies the connection manager about a dropped connection.
Notifies the connection manager about a dropped connection .
&mut self
addr
SocketAddr
now
Instant
&mut self
addr
SocketAddr
now
Instant