nquic_listener_sup (nquic v1.0.0)
View SourceTop-level listener supervisor.
rest_for_one over three children:
nquic_listener_mgr: gen_server with the accept queue, parked acceptors, resolved port, static key, and a published reference to the listener's dispatch table.nquic_partitions_sup:one_for_onecontainer holding the per- schedulernquic_server_suppartitions. Each partition publishes its pid into the dispatch table on init.nquic_receiver_sup:one_for_onecontainer of Nnquic_receiverworkers (sharing the listen port via SO_REUSEPORT when N > 1).
The dispatch ETS table is created here, owned by this supervisor process, and lives for the lifetime of the listener. Children publish their own pids into it on init; nothing else has to coordinate restart fan-out.
On rest_for_one the cascade is:
- mgr crash -> mgr + partitions + receivers all restart; fresh dispatch slots are populated by each new child's init.
- partitions crash -> partitions + receivers restart.
- receiver_sup crash -> only receivers restart.
A single partition crashing is contained inside nquic_partitions_sup
(one_for_one there) and re-publishes its slot on its own restart.
Summary
Functions
Read certificate / key / CA material from disk so the listener fails
fast on bad paths instead of crashing every connection at handshake
time. Exposed for the legacy nquic_listener shim and tests.
Start a listener supervision tree. The returned supervisor pid is the
public listener handle: nquic_listener:accept/2, nquic:get_port/1,
nquic:metrics/1, etc. all forward through to the manager child via
supervisor:which_children/1.
Functions
-spec init(map()) -> {ok, {supervisor:sup_flags(), [supervisor:child_spec()]}} | {stop, term()}.
-spec preload_certs(map()) -> {ok, map()} | {error, nquic_error:any_reason()}.
Read certificate / key / CA material from disk so the listener fails
fast on bad paths instead of crashing every connection at handshake
time. Exposed for the legacy nquic_listener shim and tests.
Start a listener supervision tree. The returned supervisor pid is the
public listener handle: nquic_listener:accept/2, nquic:get_port/1,
nquic:metrics/1, etc. all forward through to the manager child via
supervisor:which_children/1.