nquic_listener_sup (nquic v1.0.0)

View Source

Top-level listener supervisor.

rest_for_one over three children:

  1. 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.
  2. nquic_partitions_sup: one_for_one container holding the per- scheduler nquic_server_sup partitions. Each partition publishes its pid into the dispatch table on init.
  3. nquic_receiver_sup: one_for_one container of N nquic_receiver workers (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

init(Opts)

-spec init(map()) -> {ok, {supervisor:sup_flags(), [supervisor:child_spec()]}} | {stop, term()}.

preload_certs(Opts)

-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_link(Opts)

-spec start_link(map()) -> {ok, pid()} | ignore | {error, term()}.

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.