Xirsys.XTurn.ReservationStore (xturn v2.0.0)

Copy Markdown View Source

Short-lived holds for RFC 8656 RESERVATION-TOKEN relay ports.

What problem this solves

EVEN-PORT allocation can reserve the next odd port for a follow-up Allocate using RESERVATION-TOKEN. The server must keep that UDP socket bound but unused until the client claims it or the reservation expires.

Internal note

30-second TTL; expired reservations close the held socket.

RFCs

Summary

Functions

Atomically removes and returns a reservation.

Creates the public reservation ETS table.

Stores {token, socket, port} with a monotonic expiry timestamp.

Functions

claim(token)

Atomically removes and returns a reservation.

Returns {:ok, socket, port} when the token exists and has not expired, otherwise :error (expired reservations close their socket).

init()

Creates the public reservation ETS table.

reserve(token, socket, port)

Stores {token, socket, port} with a monotonic expiry timestamp.

Returns :ok.