pub fn next(&mut self) -> Option<MetaAddr> {
        let mut peer_set_guard = self.peer_set.lock().unwrap();
        let mut reconnect = peer_set_guard.reconnection_peers().next()?;

        reconnect.last_seen = Utc::now();
        reconnect.last_connection_state = PeerAddrState::AttemptPending;
        peer_set_guard.update(reconnect);

        Some(reconnect)
    }
/// Returns the next candidate for a connection attempt, if any are available.
///
/// Returns peers in this order:
/// - oldest `Responded` that are not live
/// - newest `NeverAttempted`
/// - oldest `Failed`
///
/// Skips `AttemptPending` peers and live `Responded` peers.
///
/// ## Correctness
///
/// `AttemptPending` peers will become `Responded` if they respond, or
/// become `Failed` if they time out or provide a bad response.
///
/// Live `Responded` peers will stay live if they keep responding, or
/// become a reconnection candidate if they stop responding.
Returns the next candidate for a connection attempt, if any are available.

Skips `AttemptPending` peers and live `Responded` peers.
Returns the next candidate for a connection attempt if any are available . Skips ` AttemptPending ` peers and live ` Responded ` peers .
pub fn next(&mut self) -> Option<MetaAddr> {
        let mut peer_set_guard = self.peer_set.lock().unwrap();
        let mut reconnect = peer_set_guard.reconnection_peers().next()?;
        reconnect.last_seen = Utc::now();
        reconnect.last_connection_state = PeerAddrState::AttemptPending;
        peer_set_guard.update(reconnect);
        Some(reconnect)
    }
pub fn next ( & mut self ) -> Option < MetaAddr > { let mut peer_set_guard = self . peer_set . lock ( ) . unwrap ( ) ; let mut reconnect = peer_set_guard . reconnection_peers ( ) . next ( ) ? ; reconnect . last_seen = Utc :: now ( ) ; reconnect . last_connection_state = PeerAddrState :: AttemptPending ; peer_set_guard . update ( reconnect ) ; Some ( reconnect ) }
Returns the next candidate for a connection attempt, if any are available.
Returns the next candidate for a connection attempt if any are available .
&mut self
correctness
`AttemptPending` peers will become `Responded` if they respond, or
become `Failed` if they time out or provide a bad response.

Live `Responded` peers will stay live if they keep responding, or
become a reconnection candidate if they stop responding.
` AttemptPending ` peers will become ` Responded ` if they respond or become ` Failed ` if they time out or provide a bad response . Live ` Responded ` peers will stay live if they keep responding or become a reconnection candidate if they stop responding .