pub struct H2PooledConnection { /* private fields */ }Expand description
HTTP/2 connection pool entry with multiplexing support.
Uses driver/handle architecture: a background task (driver) owns the connection and handles frame I/O, while handles send requests via channels.
Implementations§
Source§impl H2PooledConnection
impl H2PooledConnection
Sourcepub fn new(conn: H2Connection) -> Self
pub fn new(conn: H2Connection) -> Self
Create a new pooled connection from an H2Connection wrapper. Spawns a driver task to handle frame I/O.
Sourcepub fn new_with_config(conn: H2Connection, config: H2TransportConfig) -> Self
pub fn new_with_config(conn: H2Connection, config: H2TransportConfig) -> Self
Create a new pooled connection with runtime transport config.
Sourcepub fn is_alive(&self) -> bool
pub fn is_alive(&self) -> bool
Check if the connection is alive (the driver is still running and hasn’t received GOAWAY)
Sourcepub fn backpressure_stall_count(&self) -> u64
pub fn backpressure_stall_count(&self) -> u64
Number of times the driver slept 1 ms while streaming body work was pending.
Sourcepub async fn send_request(
&self,
method: Method,
uri: &Uri,
headers: impl Into<Headers>,
body: Option<Bytes>,
) -> Result<Response>
pub async fn send_request( &self, method: Method, uri: &Uri, headers: impl Into<Headers>, body: Option<Bytes>, ) -> Result<Response>
Send a request using this pooled connection. This is non-blocking - the driver handles the actual I/O.
Sourcepub async fn send_streaming_request(
&self,
method: Method,
uri: &Uri,
headers: impl Into<Headers>,
body: RequestBody,
body_timeouts: H2BodyTimeouts,
) -> Result<Response>
pub async fn send_streaming_request( &self, method: Method, uri: &Uri, headers: impl Into<Headers>, body: RequestBody, body_timeouts: H2BodyTimeouts, ) -> Result<Response>
Send a streaming request using this pooled connection.
Sourcepub async fn open_websocket_tunnel(
&self,
uri: Uri,
headers: impl Into<Headers>,
) -> Result<H2Tunnel>
pub async fn open_websocket_tunnel( &self, uri: Uri, headers: impl Into<Headers>, ) -> Result<H2Tunnel>
Open an RFC 8441 WebSocket tunnel on this pooled HTTP/2 connection.
Sourcepub fn clone_handle(&self) -> Self
pub fn clone_handle(&self) -> Self
Clone this pooled connection handle. Multiple handles can use the same underlying HTTP/2 connection.