Skip to main content

Crate tokio_bind_retry

Crate tokio_bind_retry 

Source
Expand description

Retry tokio’s TcpListener / UdpSocket bind against a transient kernel-side bind failure with bounded exponential backoff, while honouring a tokio_util::sync::CancellationToken so a daemon shutdown does not hang in the retry loop.

See the README for the motivating use cases (graceful restart, port-handover dances, lingering TIME_WAIT sockets).

Structs§

Policy
Retry parameters shared by tcp and udp.

Functions§

sleep_or_cancel
Cancel-aware sleep. Returns true if cancellation cut the sleep short, false if the sleep elapsed normally.
tcp
Bind a TcpListener with exponential backoff and cancellation.
udp
Bind a UdpSocket with exponential backoff and cancellation.