fn address_metrics_internal(&self, now: chrono::DateTime<Utc>) -> AddressMetrics {
        let responded = self.state_peers(PeerAddrState::Responded).count();
        let never_attempted_gossiped = self
            .state_peers(PeerAddrState::NeverAttemptedGossiped)
            .count();
        let never_attempted_alternate = self
            .state_peers(PeerAddrState::NeverAttemptedAlternate)
            .count();
        let failed = self.state_peers(PeerAddrState::Failed).count();
        let attempt_pending = self.state_peers(PeerAddrState::AttemptPending).count();

        let recently_live = self.recently_live_peers(now).count();
        let recently_stopped_responding = responded
            .checked_sub(recently_live)
            .expect("all recently live peers must have responded");

        AddressMetrics {
            responded,
            never_attempted_gossiped,
            never_attempted_alternate,
            failed,
            attempt_pending,
            recently_live,
            recently_stopped_responding,
        }
    }
/// Returns metrics for the addresses in this address book.
///
/// # Correctness
///
/// External callers should use [`AddressBook::address_metrics_watcher().borrow()`]
/// in production code, to avoid deadlocks.
/// (Using the watch channel receiver does not lock the address book mutex.)
Returns metrics for the addresses in this address book.
Returns metrics for the addresses in this address book .
fn address_metrics_internal(&self, now: chrono::DateTime<Utc>) -> AddressMetrics {
        let responded = self.state_peers(PeerAddrState::Responded).count();
        let never_attempted_gossiped = self
            .state_peers(PeerAddrState::NeverAttemptedGossiped)
            .count();
        let never_attempted_alternate = self
            .state_peers(PeerAddrState::NeverAttemptedAlternate)
            .count();
        let failed = self.state_peers(PeerAddrState::Failed).count();
        let attempt_pending = self.state_peers(PeerAddrState::AttemptPending).count();
        let recently_live = self.recently_live_peers(now).count();
        let recently_stopped_responding = responded
            .checked_sub(recently_live)
            .expect("all recently live peers must have responded");
        AddressMetrics {
            responded,
            never_attempted_gossiped,
            never_attempted_alternate,
            failed,
            attempt_pending,
            recently_live,
            recently_stopped_responding,
        }
    }
fn address_metrics_internal ( & self , now : chrono :: DateTime < Utc > ) -> AddressMetrics { let responded = self . state_peers ( PeerAddrState :: Responded ) . count ( ) ; let never_attempted_gossiped = self . state_peers ( PeerAddrState :: NeverAttemptedGossiped ) . count ( ) ; let never_attempted_alternate = self . state_peers ( PeerAddrState :: NeverAttemptedAlternate ) . count ( ) ; let failed = self . state_peers ( PeerAddrState :: Failed ) . count ( ) ; let attempt_pending = self . state_peers ( PeerAddrState :: AttemptPending ) . count ( ) ; let recently_live = self . recently_live_peers ( now ) . count ( ) ; let recently_stopped_responding = responded . checked_sub ( recently_live ) . expect ( " " ) ; AddressMetrics { responded , never_attempted_gossiped , never_attempted_alternate , failed , attempt_pending , recently_live , recently_stopped_responding , } }
Returns metrics for the addresses in this address book.
Returns metrics for the addresses in this address book .
&self
now
chrono::DateTime<Utc>
correctness
External callers should use [`AddressBook::address_metrics_watcher().borrow()`]
in production code, to avoid deadlocks.
(Using the watch channel receiver does not lock the address book mutex.)
External callers should use [ ` AddressBook :: address_metrics_watcher () . borrow () ` ] in production code to avoid deadlocks . ( Using the watch channel receiver does not lock the address book mutex . )