Struct h2::proto::connection::Connection
source · pub(crate) struct Connection<T, P, B: Buf = Bytes>where
P: Peer,{
codec: Codec<T, Prioritized<B>>,
inner: ConnectionInner<P, B>,
}
Expand description
An H2 connection
Fields§
§codec: Codec<T, Prioritized<B>>
Read / write frame values
inner: ConnectionInner<P, B>
Implementations§
source§impl<T, P, B> Connection<T, P, B>
impl<T, P, B> Connection<T, P, B>
pub fn new( codec: Codec<T, Prioritized<B>>, config: Config, ) -> Connection<T, P, B>
sourcepub(crate) fn set_target_window_size(&mut self, size: u32)
pub(crate) fn set_target_window_size(&mut self, size: u32)
connection flow control
sourcepub(crate) fn set_initial_window_size(
&mut self,
size: u32,
) -> Result<(), UserError>
pub(crate) fn set_initial_window_size( &mut self, size: u32, ) -> Result<(), UserError>
Send a new SETTINGS frame with an updated initial window size.
sourcepub(crate) fn set_enable_connect_protocol(&mut self) -> Result<(), UserError>
pub(crate) fn set_enable_connect_protocol(&mut self) -> Result<(), UserError>
Send a new SETTINGS frame with extended CONNECT protocol enabled.
sourcepub(crate) fn max_send_streams(&self) -> usize
pub(crate) fn max_send_streams(&self) -> usize
Returns the maximum number of concurrent streams that may be initiated by this peer.
sourcepub(crate) fn max_recv_streams(&self) -> usize
pub(crate) fn max_recv_streams(&self) -> usize
Returns the maximum number of concurrent streams that may be initiated by the remote peer.
sourcefn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Error>>
fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Error>>
Returns Ready
when the connection is ready to receive a frame.
Returns Error
as this may raise errors that are caused by delayed
processing of received frames.
sourcefn poll_go_away(&mut self, cx: &mut Context<'_>) -> Poll<Option<Result<Reason>>>
fn poll_go_away(&mut self, cx: &mut Context<'_>) -> Poll<Option<Result<Reason>>>
Send any pending GOAWAY frames.
This will return Some(reason)
if the connection should be closed
afterwards. If this is a graceful shutdown, this returns None
.
pub fn go_away_from_user(&mut self, e: Reason)
fn take_error( &mut self, ours: Reason, initiator: Initiator, ) -> Result<(), Error>
sourcepub fn maybe_close_connection_if_no_streams(&mut self)
pub fn maybe_close_connection_if_no_streams(&mut self)
Closes the connection by transitioning to a GOAWAY state iff there are no streams or references
pub(crate) fn take_user_pings(&mut self) -> Option<UserPings>
sourcepub fn poll(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Error>>
pub fn poll(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Error>>
Advances the internal state of the connection.