pub struct ConnectionPool { /* private fields */ }Expand description
Thread-safe connection pool shared across concurrent forward_request
tasks. Cloneable — internal state lives behind an Arc<Mutex<...>>
so cloning is cheap (bumps the ref-count).
Implementations§
Source§impl ConnectionPool
impl ConnectionPool
pub fn new() -> Self
Sourcepub async fn get_h2(&self, host: &str, port: u16) -> Option<PooledH2Sender>
pub async fn get_h2(&self, host: &str, port: u16) -> Option<PooledH2Sender>
Try to reuse an HTTP/2 sender for (host, port). Returns None if
we have no cached entry OR the cached entry has gone idle beyond
IDLE_TIMEOUT. Fresh senders returned from here can be used
immediately — SendRequest clones share the same underlying
connection driver task.
Sourcepub async fn store_h2(&self, host: &str, port: u16, sender: PooledH2Sender)
pub async fn store_h2(&self, host: &str, port: u16, sender: PooledH2Sender)
Cache a freshly-negotiated HTTP/2 sender so future requests to the same host reuse the underlying TCP+TLS+h2 session.
Sourcepub async fn invalidate_h2(&self, host: &str, port: u16)
pub async fn invalidate_h2(&self, host: &str, port: u16)
Remove the cached h2 sender for a host — call this when a request against a cached sender fails, so the next attempt re-handshakes.
Trait Implementations§
Source§impl Clone for ConnectionPool
impl Clone for ConnectionPool
Source§fn clone(&self) -> ConnectionPool
fn clone(&self) -> ConnectionPool
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ConnectionPool
impl Debug for ConnectionPool
Source§impl Default for ConnectionPool
impl Default for ConnectionPool
Source§fn default() -> ConnectionPool
fn default() -> ConnectionPool
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for ConnectionPool
impl !UnwindSafe for ConnectionPool
impl Freeze for ConnectionPool
impl Send for ConnectionPool
impl Sync for ConnectionPool
impl Unpin for ConnectionPool
impl UnsafeUnpin for ConnectionPool
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§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
Mutably borrows from an owned value. Read more