Xirsys.XTurn.Allocate.Supervisor (xturn v2.0.0)

Copy Markdown View Source

Dynamic supervisor for per-client TURN allocation GenServers.

What problem this solves

Each successful Allocate spawns a dedicated process for relay state. A :simple_one_for_one supervisor with :temporary restarts lets allocations start and stop independently without restarting siblings when one client leaves.

Internal note

Child module is typically Allocate.Client.

RFCs

  • RFC 5766 (allocation lifetime and teardown)

Summary

Functions

Returns a specification to start this module under a supervisor.

Starts a new allocation worker under this supervisor.

Starts the allocation supervisor.

Terminates an allocation worker pid.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_child(id, listener, tuple5, lifetime)

Starts a new allocation worker under this supervisor.

Parameters

  • id - allocation transaction id / store key
  • listener - client %ClientSocket{}
  • tuple5 - client five-tuple
  • lifetime - initial lifetime in seconds

start_link(alloc)

Starts the allocation supervisor.

Parameters

  • alloc - allocation worker module (typically Allocate.Client)

terminate_child(child)

Terminates an allocation worker pid.