nquic_protocol_migration (nquic v1.0.0)
View SourceConnection migration and PMTUD for the QUIC protocol state.
Pure functions over #conn_state{} covering RFC 9000 Section 9
(connection migration: peer-address update, path validation outcome,
preferred-address handoff) and RFC 8899 (Packetisation Layer Path MTU
Discovery: probe acknowledgement, loss, and black-hole reaction).
Extracted from nquic_protocol as part of REVIEW_PLAN.md Phase 4.4.
External side effects are limited to delegating into nquic_path,
nquic_pmtud, nquic_loss, nquic_socket, and nquic_protocol_cid.
PATH_CHALLENGE frames produced during preferred-address migration are
queued through nquic_protocol_send_queues:queue_app_frame/2.
Summary
Functions
Enable PMTUD on the connection. Starts probe search.
Handle preferred address migration (RFC 9000 Section 9.6). Installs the CID from the preferred_address transport parameter at sequence 1, selects the matching address family, and initiates path validation by queuing a PATH_CHALLENGE frame. Returns the updated state and a path validation timeout action.
Called on black hole detection. Reverts to BASE_PLPMTU.
Called when a PMTUD probe was acknowledged. Updates MTU if search progresses.
Called when a PMTUD probe was lost.
Functions
-spec apply_peer_update(nquic_socket:sockaddr(), nquic_protocol:state()) -> nquic_protocol:state().
-spec check_migration_allowed(nquic_protocol:state()) -> ok | {error, nquic_error:any_reason()}.
-spec complete_migration(nquic_protocol:state()) -> {ok, nquic_protocol:state()} | {error, no_available_cids}.
-spec enable_pmtud(nquic_protocol:state()) -> nquic_protocol:state().
Enable PMTUD on the connection. Starts probe search.
-spec handle_preferred_address(nquic_transport:preferred_address(), nquic_protocol:state()) -> {ok, nquic_protocol:state(), [nquic_protocol:timeout_action()]}.
Handle preferred address migration (RFC 9000 Section 9.6). Installs the CID from the preferred_address transport parameter at sequence 1, selects the matching address family, and initiates path validation by queuing a PATH_CHALLENGE frame. Returns the updated state and a path validation timeout action.
-spec maybe_detect_black_hole(nquic_protocol:state()) -> nquic_protocol:state().
-spec pmtud_on_black_hole(nquic_protocol:state()) -> nquic_protocol:state().
Called on black hole detection. Reverts to BASE_PLPMTU.
-spec pmtud_on_probe_acked(nquic_protocol:state()) -> nquic_protocol:state().
Called when a PMTUD probe was acknowledged. Updates MTU if search progresses.
-spec pmtud_on_probe_lost(nquic_protocol:state()) -> nquic_protocol:state().
Called when a PMTUD probe was lost.
-spec revert_migration(nquic_protocol:state()) -> nquic_protocol:state().
-spec select_preferred_peer(nquic_transport:preferred_address(), nquic_socket:sockaddr()) -> nquic_socket:sockaddr().