pub struct QuicStreamPool { /* private fields */ }Expand description
QUIC stream-aware connection pool: a bounded set of QUIC connections
per endpoint address, each carrying many H3 streams. One
QuicStreamPool serves one upstream (the per-upstream connection
cap and trust roots are fixed at build time); endpoint addresses are
the inner key so a multi-endpoint upstream shares one pool.
The pool binds ONE quinn client endpoint (an ephemeral 0.0.0.0:0
UDP socket) for all dials; quinn multiplexes connections over it.
Implementations§
Source§impl QuicStreamPool
impl QuicStreamPool
Sourcepub fn new(
roots: RootCertStore,
connect_timeout: Duration,
max_conns_per_endpoint: usize,
idle_timeout: Duration,
stats: Arc<UpstreamStats>,
) -> Result<Self, H3Error>
pub fn new( roots: RootCertStore, connect_timeout: Duration, max_conns_per_endpoint: usize, idle_timeout: Duration, stats: Arc<UpstreamStats>, ) -> Result<Self, H3Error>
Build a pool for one upstream’s trust roots and connection cap.
roots is the trust store the QUIC handshake verifies the
upstream’s server certificate against (webpki by default, the
upstream’s trusted_ca_file bundle when configured). Binds the
quinn client endpoint to an ephemeral port.
Sourcepub fn tls_config(&self) -> &Arc<ClientConfig>
pub fn tls_config(&self) -> &Arc<ClientConfig>
The rustls client config this pool verifies against (shared with the QUIC active health probe so a probe and a proxied request can never disagree about who to trust).
Sourcepub async fn acquire(
&self,
addr: SocketAddr,
server_name: &str,
) -> Result<SendRequest<OpenStreams, Bytes>, H3Error>
pub async fn acquire( &self, addr: SocketAddr, server_name: &str, ) -> Result<SendRequest<OpenStreams, Bytes>, H3Error>
Acquire a cloneable request sender for addr: reuse a live pooled
connection if one exists, otherwise dial a new one (bounded by
max_conns_per_endpoint). Dead entries (driver finished) are
reaped opportunistically here and in Self::sweep.
Sourcepub fn sweep(&self)
pub fn sweep(&self)
Reap connections idle past idle_timeout (no stream opened through
them since last_used). Called periodically by the handle’s
sweep task and by tests. Dropping the reaped ConnEntry drops its
SendRequest clone; the connection’s last sender (in the driver
task’s owned Connection) keeps it alive until wait_idle
resolves, so reaping is graceful.
Sourcepub fn live_count(&self, addr: SocketAddr) -> usize
pub fn live_count(&self, addr: SocketAddr) -> usize
Number of live pooled connections for addr (observability/tests).
Auto Trait Implementations§
impl !Freeze for QuicStreamPool
impl !RefUnwindSafe for QuicStreamPool
impl Send for QuicStreamPool
impl Sync for QuicStreamPool
impl Unpin for QuicStreamPool
impl !UnwindSafe for QuicStreamPool
Blanket Implementations§
§impl<T> AnyExt for T
impl<T> AnyExt for T
§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
T behind reference§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
T behind mutable reference§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
T behind Rc pointer§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
T behind Arc pointer§fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
fn downcast_box<T>(this: Box<Self>) -> Result<Box<T>, Box<Self>>where
T: Any,
T behind Box pointer§fn downcast_move<T>(this: Self) -> Option<T>
fn downcast_move<T>(this: Self) -> Option<T>
Self to T,
useful only in generic context as a workaround for specializationSource§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more