fn remove_perished_connections_from_pool(pool: &ConnectionPool) {
    let mut connections = pool.inner.connections.write().unwrap();
    let mut i = 0;

    while i < connections.len() {
        if connections[i].is_stale(pool.inner.generation.load(Ordering::SeqCst)) {
            pool.close_connection(connections.remove(i), ConnectionClosedReason::Stale);
        } else if connections[i].is_idle(pool.inner.max_idle_time) {
            pool.close_connection(connections.remove(i), ConnectionClosedReason::Idle);
        } else {
            i += 1;
        }
    }
}
/// Iterate over the connections and remove any that are stale or idle.
Iterate over the connections and remove any that are stale or idle.
Iterate over the connections and remove any that are stale or idle .
fn remove_perished_connections_from_pool(pool: &ConnectionPool) {
    let mut connections = pool.inner.connections.write().unwrap();
    let mut i = 0;
    while i < connections.len() {
        if connections[i].is_stale(pool.inner.generation.load(Ordering::SeqCst)) {
            pool.close_connection(connections.remove(i), ConnectionClosedReason::Stale);
        } else if connections[i].is_idle(pool.inner.max_idle_time) {
            pool.close_connection(connections.remove(i), ConnectionClosedReason::Idle);
        } else {
            i += 1;
        }
    }
}
fn remove_perished_connections_from_pool ( pool : & ConnectionPool ) { let mut connections = pool . inner . connections . write ( ) . unwrap ( ) ; let mut i = 0 ; while i < connections . len ( ) { if connections [ i ] . is_stale ( pool . inner . generation . load ( Ordering :: SeqCst ) ) { pool . close_connection ( connections . remove ( i ) , ConnectionClosedReason :: Stale ) ; } else if connections [ i ] . is_idle ( pool . inner . max_idle_time ) { pool . close_connection ( connections . remove ( i ) , ConnectionClosedReason :: Idle ) ; } else { i += 1 ; } } }
Iterate over the connections and remove any that are stale or idle.
Iterate over the connections and remove any that are stale or idle .
pool
&ConnectionPool
pool
&ConnectionPool