Skip to main content

serve_with_client_silence_reaping

Function serve_with_client_silence_reaping 

Source
pub async fn serve_with_client_silence_reaping(
    listener: TcpListener,
    router: Router,
    on_accept: impl Fn(&TcpStream) + Send,
    stalled_reaps: Arc<Counter>,
    accept_failures: Arc<Counter>,
    header_read_timeout: Duration,
    body_frame_gap: Duration,
    shutdown: impl Future<Output = ()> + Send + 'static,
) -> Result<()>
Expand description

Serve router on listener with client-silence reaping, resolving after shutdown fires and every remaining connection drains. The caller wraps the post-shutdown tail in its own drain-budget timeout. on_accept runs synchronously per accepted socket (socket-option tuning — the caller owns its failure/log policy). The two silence bounds are parameters so tests can exercise reaping in milliseconds; production callers pass HEADER_READ_TIMEOUT / BODY_FRAME_GAP_TIMEOUT.