ONC RPC v2 TCP listener.
Spawns a gen_tcp accept loop that creates one process per
connection (via Task.Supervisor). Each connection process reads
bytes off the socket, reassembles them with
Tahr.RPC.RecordMarking, decodes the call envelope with
Tahr.RPC.Message, dispatches via Tahr.RPC.Dispatcher
using the configured program registry, and writes the encoded
reply back.
Options
:port(default2049) — TCP port to bind. Pass0to bind an ephemeral port (used by tests). The actual bound port is available viaport/1.:bind(default"0.0.0.0") — IP address to bind.:programs(required) — seeTahr.RPC.Dispatcher.programs/0.:portmap_mappings(default%{}) —{prog, vers, proto}→ port map for the portmapper handler. The server will merge{100003, 3, 6}(NFSv3 over TCP) on top of this with the actual bound port.:name(default__MODULE__) — registered name for the listener process.
Backpressure
One Erlang process per connection means each client's calls are naturally serialised by its mailbox. Slow handlers don't impact other clients.
Summary
Types
Per-connection state.
Functions
Returns a specification to start this module under a supervisor.
Return the actual TCP port the listener is bound on.
Start the listener under the given supervision tree.
Types
@type conn_state() :: %{ socket: :gen_tcp.socket(), buffer: binary(), programs: Tahr.RPC.Dispatcher.programs(), portmap_mappings: %{ required({non_neg_integer(), non_neg_integer(), non_neg_integer()}) => non_neg_integer() } }
Per-connection state.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec port(GenServer.server()) :: non_neg_integer()
Return the actual TCP port the listener is bound on.
@spec start_link(keyword()) :: GenServer.on_start()
Start the listener under the given supervision tree.