nquic_protocol_timer (nquic v1.0.0)

View Source

Timer-action orchestration for the QUIC protocol state.

Pure functions over #conn_state{} that translate connection state into the set_timer / cancel_timer actions the owner must schedule: the ACK-delay timer, the idle timer (RFC 9000 Section 10.1), the PTO timer (RFC 9002 Section 6.2), the path-validation timer (RFC 9000 Section 8.2), and the PMTUD probe timer (RFC 8899).

compute_timer_actions/1 is the aggregate entry point used after nquic_protocol:handle_packet/3 and nquic_protocol:flush/1. The idle and PTO values are cached in #conn_state{} so unchanged timers do not re-emit actions. External side effects are limited to delegating into nquic_loss, nquic_pmtud, and nquic_path; the idle bound is resolved via nquic_protocol:get_idle_timeout/2.

Summary

Functions

Compute timer actions based on current state. Returns idle and PTO timer actions the caller should schedule. Call after nquic_protocol:handle_packet/3 or nquic_protocol:flush/1 to keep timers up to date. Caches idle and PTO values to skip unchanged timer actions. Uses accumulator to avoid ++ overhead.

Functions

compute_path_validation_timeout/1

-spec compute_path_validation_timeout(nquic_protocol:state()) -> non_neg_integer().

compute_pto_timer_actions/1

-spec compute_pto_timer_actions(nquic_protocol:state()) -> [nquic_protocol:timeout_action()].

compute_timer_actions(State)

-spec compute_timer_actions(nquic_protocol:state()) ->
                               {[nquic_protocol:timeout_action()], nquic_protocol:state()}.

Compute timer actions based on current state. Returns idle and PTO timer actions the caller should schedule. Call after nquic_protocol:handle_packet/3 or nquic_protocol:flush/1 to keep timers up to date. Caches idle and PTO values to skip unchanged timer actions. Uses accumulator to avoid ++ overhead.