masque_server_connection (masque v0.7.0)

View Source

Per-H3-connection owner + router for MASQUE tunnels.

The listener's connection_handler` hook spawns one of these gen_servers per accepted H3 connection and hands its pid to `quic_h3 as the connection's owner. That makes it the single receiver of all owner-addressed events (datagrams, stream-data for non-claimed streams, etc.), which we then route to the per-tunnel session process keyed by StreamId.

Summary

Functions

Cancel a pending session that timed out.

Register SessionPid` as the owner of `StreamId`s datagrams.

Return the session module for the given args.

Start a session process and register it. The router spawns the session asynchronously so it stays responsive for datagram routing. The caller blocks until the session init completes.

Functions

cancel_pending(RouterPid, StreamId)

-spec cancel_pending(pid(), non_neg_integer()) -> ok | {error, already_activated}.

Cancel a pending session that timed out.

code_change(OldVsn, S, Extra)

handle_call(Req, From, S)

handle_cast(Msg, S)

handle_info(Msg, S)

init(_)

lookup_session(RouterPid, StreamId)

-spec lookup_session(pid(), non_neg_integer()) -> {ok, pid()} | error.

register_session(RouterPid, StreamId, SessionPid)

-spec register_session(pid(), non_neg_integer(), pid()) -> ok.

Register SessionPid` as the owner of `StreamId`s datagrams.

session_module(_)

-spec session_module(map()) -> module().

Return the session module for the given args.

start_link(MaxTunnels)

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

start_session(RouterPid, SessionArgs)

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

Start a session process and register it. The router spawns the session asynchronously so it stays responsive for datagram routing. The caller blocks until the session init completes.

terminate(Reason, State)

unregister_session(RouterPid, StreamId)

-spec unregister_session(pid(), non_neg_integer()) -> ok.