Skip to main content

record_ack_within_rate

Function record_ack_within_rate 

Source
pub fn record_ack_within_rate(
    times: &mut Vec<u64>,
    now: u64,
    window: u64,
    max: usize,
) -> bool
Expand description

Per-peer ack rate gate (RFC-004 AC-HP3 — a 100-probe flood must yield ≤ a handful of acks, bounded responder CPU). Prunes times to the window, then: >= max remaining → refuse the ack (false); else record now and allow (true). Same sliding-window shape as the relay’s intro gate. Pure → unit-tested. The daemon holds times per peer in a process-static map.