Skip to main content

Module lazy_quinn

Module lazy_quinn 

Source
Expand description

Lazy-connecting quinn RPC transport.

The dial factory is synchronous and does no I/O, but a networked QUIC peer must be connected before the first request. This wrapper bridges that: it holds the dial target (addr + server_name + the QuicServerAuth policy) and connects on the first send(), caching the established session for subsequent calls — exactly the lazy-connect model ZmqConnection uses, so sync construction + zero I/O at dial time is preserved (A1 spike). The connect path (WebPKI vs cert-hash pin) is selected by the auth policy.

§Re-dial / self-heal

On a send() error the cached session is dropped, so the next call re-dials — like ZmqConnection, which a dead cached session would otherwise not recover from. This is deliberately coarse: it re-dials on any failure, including a per-request timeout on an otherwise-live connection. Refined, liveness-based re-dial with backoff is the connection-manager’s job (#156); this wrapper only needs to not strand a dead session.

Concurrent first-sends are single-flighted: the dial happens under the cache lock, so N racing callers dial once and the rest reuse the session. The connected handle is cloned out from under the lock (both QuinnTransport and its Session are cheap Clone), so send() itself never holds the lock — only the dial does.

Structs§

LazyQuinnTransport
A quinn RPC transport that connects on first use and caches the session.