Function massa_bootstrap::listener::drain_accept

source ยท
fn drain_accept<S>(
    accept: impl FnMut() -> Result<S>,
    out: &mut Vec<S>,
    max: usize,
) -> bool
Expand description

Drain at most max currently-ready connections from accept into out.

The drain ends on the first error, whether it is WouldBlock (no more pending connections) or any other error such as a persistent EMFILE / ENFILE. Ending the drain on a non-WouldBlock error (instead of continue-ing) is what prevents a sticky listener-level failure from spinning poll() forever and starving the STOP_LISTENER token.

Returns true if the drain stopped because max was reached, meaning the backlog may still hold connections that the caller has to come back for.