pub struct Connection<C, B>where
C: Connection<B>,
B: Buf,{
pub inner: ConnectionInner<C, B>,
/* private fields */
}Expand description
Server connection driver
The Connection struct manages a connection from the side of the HTTP/3 server
Create a new Instance with Connection::new(). Accept incoming requests with Connection::accept(). And shutdown a connection with Connection::shutdown().
Fields§
§inner: ConnectionInner<C, B>TODO: temporarily break encapsulation for WebTransportSession
Implementations§
Source§impl<C, B> Connection<C, B>where C: Connection<B>, B: Buf,
impl<C, B> Connection<C, B>where C: Connection<B>, B: Buf,
Sourcepub async fn new(conn: C) -> Result<Self, ConnectionError>
pub async fn new(conn: C) -> Result<Self, ConnectionError>
Create a new HTTP/3 server connection with default settings
Use a custom super::builder::Builder with super::builder::builder() to create a connection with different settings. Provide a Connection which implements quic::Connection.
Source§impl<C, B> Connection<C, B>where C: Connection<B>, B: Buf,
impl<C, B> Connection<C, B>where C: Connection<B>, B: Buf,
Sourcepub async fn accept( &mut self, ) -> Result<Option<RequestResolver<C, B>>, ConnectionError>
pub async fn accept( &mut self, ) -> Result<Option<RequestResolver<C, B>>, ConnectionError>
Accept an incoming request.
This method returns a RequestResolver which can be used to read the request and send the response. This method will return None when the connection receives a GOAWAY frame and all requests have been completed.
Sourcepub async fn shutdown( &mut self, max_requests: usize, ) -> Result<(), ConnectionError>
pub async fn shutdown( &mut self, max_requests: usize, ) -> Result<(), ConnectionError>
Initiate a graceful shutdown, accepting max_request potentially still in-flight
See connection shutdown for more information.