Xirsys.Sockets.Acceptor (xturn_sockets v2.2.1)

View Source

Accept loop for connection-oriented transports (TCP, TLS, DTLS).

What problem this solves

TURN-over-TCP and TURNS need a long-lived listener that accepts client connections and hands each socket to a dedicated Connection process under SockSupervisor. This GenServer listens, accepts with a timeout, transfers socket ownership, then re-arms {active, :once} on the child so TLS 1.3 application data is not delivered to the acceptor.

Transport.SCTP.accept/2 is not supported by this loop.

RFCs

  • RFC 8656 - TURN (client/server over TCP/TLS)
  • No STUN/TURN RFC for accept loops; OTP process supervision applies

Summary

Functions

Returns a specification to start this module under a supervisor.

Bound port of a running acceptor (useful when :port was 0).

Listens and starts accepting.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

port(pid)

Bound port of a running acceptor (useful when :port was 0).

Parameters

start_link(opts)

Listens and starts accepting.

Parameters

opts is a keyword list:

  • :transport - Xirsys.Sockets.Transport module (required)
  • :ip / :port - bind address (required)
  • :pipeline - pipeline module, or omit and pass :accumulator + :handler
  • :listen_opts - extra options forwarded to listen/3
  • :assigns - map copied onto each Conn
  • :accept_timeout - accept wait in milliseconds (default 1000)
  • :connection_supervisor - SockSupervisor name or pid (default SockSupervisor)