tokio only.Expand description
Async real-socket UDP adapter over the sans-IO SRT engine.
The sans-IO crate::caller::CallerHandshake / crate::listener::ListenerHandshake
engines never touch a socket — they turn state transitions into typed events
and byte buffers. The ARQ sender/receiver, TSBPD scheduler, and LiveCC
pacing controller follow the same contract: all take caller-supplied
now: core::time::Duration and never read a wall clock.
This module is the thin tokio layer that actually moves bytes over a
tokio::net::UdpSocket, drives the handshake to completion, and then
runs a background driver task per connection that pumps socket RX →
engines → socket TX and, crucially, ticks the timers (retransmit, ACK,
NAK, TSBPD release) on a fixed tokio::time::interval — so loss recovery
keeps making progress even when the application is neither sending nor
receiving at that instant. The sans-IO core stays no_std; the adapter is
pure plumbing.
§Why a background task
SRT reliability is bidirectional and continuous: a receiver that detects a
gap emits a NAK, and the sender must react to that NAK by retransmitting
— long after the application handed it the original payload. A purely
pull-based send/recv (one that only advances the protocol while the
app is blocked inside a call) deadlocks the moment a fire-and-forget sender
stops calling send: the inbound NAK is never drained and the lost packet
is never resent. The driver task decouples protocol progress from
application call timing: SrtSocket::send enqueues a payload and returns
immediately, SrtSocket::recv awaits a delivered payload, and the task
in between runs the select loop (RX / app-send / periodic tick) forever
until the peer shuts down or the SrtSocket is dropped.
§Structure
SrtListener— binds a UDP port and accepts incoming SRT connections, returning aSrtSocketper connected peer.SrtSocket— a handle to an established SRT connection (caller or listener role) with asyncsendandrecvfor application payloads; the actual protocol runs on the background driver task the handle owns.
§Feature gate
Only available with features = ["tokio"] (implies std). Without the
tokio feature, the crate stays no_std+alloc and nothing in this
module is compiled.
Structs§
- SrtListener
- An SRT listener that accepts incoming Caller connections.
- SrtSocket
- A handle to an established SRT connection over UDP.