nhttp_transport_sup (nhttp v1.0.0)

View Source

Per-transport supervisor for nhttp.

Owns one transport's registry table, connection counter, listen socket (or QUIC listener) and the subtree that accepts and tracks connections. A nhttp_listener parents one nhttp_transport_sup per transport it serves. A single-transport listener has exactly one.

The subtree restarts rest_for_one so a tracker crash cascades through the connection and acceptor supervisors that depend on it, while a crash of the whole transport stays contained below the one_for_one listener.

Summary

Functions

Build the nquic listen options for this transport. 0-RTT (QUIC early data) is left off: nquic refuses early data unless the listen options carry {replay_protection, Module}, and this map never sets it. No application bytes are processed before the handshake completes, so a replayed non-idempotent method cannot reach the handler (RFC 8470, RFC 9001 §9.2). Enabling 0-RTT here would require pairing it with a Too Early (425) / defer policy.

Start a transport supervisor linked to the calling process.

Functions

init/1

-spec init({term(), tcp | ssl | quic, [nhttp:version()], nhttp:opts()}) ->
              {ok, {supervisor:sup_flags(), [supervisor:child_spec()]}} | {stop, nhttp:start_error()}.

quic_listen_opts(Alpn, Tls, Opts, HandlerOpts)

-spec quic_listen_opts([binary()], nhttp:tls(), nhttp:opts(), map()) -> map().

Build the nquic listen options for this transport. 0-RTT (QUIC early data) is left off: nquic refuses early data unless the listen options carry {replay_protection, Module}, and this map never sets it. No application bytes are processed before the handshake completes, so a replayed non-idempotent method cannot reach the handler (RFC 8470, RFC 9001 §9.2). Enabling 0-RTT here would require pairing it with a Too Early (425) / defer policy.

start_link(LogicalName, Transport, Versions, Opts)

-spec start_link(term(), tcp | ssl | quic, [nhttp:version()], nhttp:opts()) ->
                    {ok, pid()} | ignore | {error, term()}.

Start a transport supervisor linked to the calling process.

LogicalName is the listener's logical name, copied into this transport's registry table for logs / otel. Transport selects the listening machinery. Versions are the already-validated protocol versions this transport serves.