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,
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<(Request<()>, RequestStream<C::BidiStream, B>)>, Error>
pub async fn accept( &mut self, ) -> Result<Option<(Request<()>, RequestStream<C::BidiStream, B>)>, Error>
Accept an incoming request.
It returns a tuple with a http::Request and an RequestStream.
The http::Request is the received request from the client.
The RequestStream can be used to send the response.
Sourcepub fn accept_with_frame(
&mut self,
stream: FrameStream<C::BidiStream, B>,
frame: Result<Option<Frame<PayloadLen>>, FrameStreamError>,
) -> Result<Option<ResolveRequest<C, B>>, Error>
pub fn accept_with_frame( &mut self, stream: FrameStream<C::BidiStream, B>, frame: Result<Option<Frame<PayloadLen>>, FrameStreamError>, ) -> Result<Option<ResolveRequest<C, B>>, Error>
Accepts an http request where the first frame has already been read and decoded.
This is needed as a bidirectional stream may be read as part of incoming webtransport
bi-streams. If it turns out that the stream is not a WEBTRANSPORT_STREAM the request
may still want to be handled and passed to the user.
Sourcepub async fn shutdown(&mut self, max_requests: usize) -> Result<(), Error>
pub async fn shutdown(&mut self, max_requests: usize) -> Result<(), Error>
Initiate a graceful shutdown, accepting max_request potentially still in-flight
See connection shutdown for more information.
Sourcepub fn poll_accept_request(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Option<C::BidiStream>, Error>>
pub fn poll_accept_request( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Option<C::BidiStream>, Error>>
Accepts an incoming bidirectional stream.
This could be either a Request or a WebTransportBiStream, the first frame’s type decides.
Source§impl<C, B> Connection<C, B>
impl<C, B> Connection<C, B>
Source§impl<C, B> Connection<C, B>
impl<C, B> Connection<C, B>
Sourcepub fn read_datagram(&mut self) -> ReadDatagram<'_, C, B> ⓘ
pub fn read_datagram(&mut self) -> ReadDatagram<'_, C, B> ⓘ
Reads an incoming datagram