Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Errors, Cancellation, Timers, and Drain

ReliabilityDistributed lifecycleRevision c8b02d1

Quinn distinguishes connection errors from stream-local reset, peer stop, closed-stream misuse, and rejected 0-RTT. This matters because retrying a write after flow-control blocking is normal, while retrying rejected early data may duplicate application effects.

Dropping an unfinished send stream resets it; dropping a receive stream stops it, unless the operation already reached a terminal state. Async convenience methods document cancellation safety: a cancelled write_all may already have accepted a prefix, so callers cannot assume transactional behavior.

The connection driver maintains the next protocol timeout using an abstract timer and checks the runtime clock directly on each poll. Loss recovery, handshake expiry, keep-alive, and idle timeout therefore advance through the same deterministic core as packet events.

Termination stores one ConnectionError, wakes every blocked class of waiter, and reports a drained event to the endpoint. Endpoint::close stops new work; wait_idle waits until the connection routing set is empty. That is graceful shutdown as a protocol-obligation proof, not merely socket drop.