Skip to main content

record_loop

Function record_loop 

Source
pub fn record_loop(
    open: &StreamOpen,
    sink: &mut dyn Write,
    cancel: &dyn Fn() -> bool,
    max_bytes: u64,
    buf_size: usize,
    backoff: &dyn Fn(u32),
) -> RecordStats
Expand description

Record open’s stream into sink: open → copy → on EOF/error reconnect (after backoff) until cancel fires or max_bytes is reached. backoff(attempt) is the inter-attempt pause (the real one sleeps; tests pass a no-op). The loop only ends on cancel/cap — a persistently-failing source keeps retrying because the recorder is meant to run for as long as the print is active, and the caller flips cancel when the print ends.