Quic.Recovery (elixir_quic v0.16.7)

Copy Markdown View Source

Explicit-time QUIC packet-number spaces and loss recovery state.

Packet numbers are allocated by reserve/4 and are never reused. A packet moves through :reserved, :queued, :sent, then :acked, :lost, or :failed. ACKs received before a local send receipt are retained as a bounded pending acknowledgement and resolved when the receipt arrives.

Summary

Functions

Recompute the next deadline from actual sent packets, without advancing time.

Discard an encryption space's outstanding work while preserving allocated packet numbers.

Record an authenticated packet number received in a packet-number space.

Current probe timeout duration in microseconds, before PTO backoff.

Permanently retire Initial/Handshake recovery, preserving the next packet number.

Types

initial_state()

@type initial_state() :: %Quic.Recovery{
  congestion: %Quic.Congestion.NewReno{
    acked_bytes: 0,
    bytes_in_flight: 0,
    cwnd: term(),
    max_datagram_size: term(),
    mss: number(),
    ssthresh: term()
  },
  deadline: nil,
  max_ack_ranges: term(),
  max_sent_packets: term(),
  rtt: %Quic.Recovery.RTT{
    ack_delay_exponent: term(),
    latest: nil,
    max_ack_delay: term(),
    min: nil,
    pto_count: 0,
    smoothed: nil,
    variance: nil
  },
  spaces: map(),
  timer_generation: 0
}

t()

@type t() :: %Quic.Recovery{
  congestion: term(),
  deadline: term(),
  max_ack_ranges: term(),
  max_sent_packets: term(),
  rtt: term(),
  spaces: term(),
  timer_generation: term()
}

Functions

arm(state)

Recompute the next deadline from actual sent packets, without advancing time.

discard_space(state, space)

Discard an encryption space's outstanding work while preserving allocated packet numbers.

local_send(state, space, number, arg4, at)

@spec local_send(t(), atom(), non_neg_integer(), :ok | {:error, term()}, integer()) ::
  {:ok, t(), [atom()]} | {:error, atom()}

new(opts \\ [])

@spec new(keyword()) :: initial_state()

note_received(state, space, number)

@spec note_received(t(), atom(), non_neg_integer()) :: {:ok, t()} | {:error, atom()}

Record an authenticated packet number received in a packet-number space.

on_time(state, now)

@spec on_time(t(), integer()) :: {:ok, t(), map()}

pto_duration(state)

@spec pto_duration(t()) :: pos_integer()

Current probe timeout duration in microseconds, before PTO backoff.

receive_ack(state, space, ack, at)

@spec receive_ack(t(), atom(), map(), integer()) ::
  {:ok, t(), map()} | {:error, atom()}

reserve(state, space, metadata \\ %{}, bytes \\ 0)

@spec reserve(t(), atom(), map(), non_neg_integer()) ::
  {:ok, t(), Quic.Recovery.Packet.t()} | {:error, atom()}

retire_space(state, space)

@spec retire_space(t(), :initial | :handshake) :: t()

Permanently retire Initial/Handshake recovery, preserving the next packet number.

timer_expired?(recovery, token, now)

@spec timer_expired?(t(), non_neg_integer(), integer()) :: boolean()

transition(state, space, number, status)

@spec transition(t(), atom(), non_neg_integer(), atom()) ::
  {:ok, t()} | {:error, atom()}