Struct h2::proto::streams::counts::Counts

source ·
pub(super) struct Counts {
    peer: Dyn,
    max_send_streams: usize,
    num_send_streams: usize,
    max_recv_streams: usize,
    num_recv_streams: usize,
    max_local_reset_streams: usize,
    num_local_reset_streams: usize,
    max_remote_reset_streams: usize,
    num_remote_reset_streams: usize,
    max_local_error_reset_streams: Option<usize>,
    num_local_error_reset_streams: usize,
}

Fields§

§peer: Dyn

Acting as a client or server. This allows us to track which values to inc / dec.

§max_send_streams: usize

Maximum number of locally initiated streams

§num_send_streams: usize

Current number of remote initiated streams

§max_recv_streams: usize

Maximum number of remote initiated streams

§num_recv_streams: usize

Current number of locally initiated streams

§max_local_reset_streams: usize

Maximum number of pending locally reset streams

§num_local_reset_streams: usize

Current number of pending locally reset streams

§max_remote_reset_streams: usize

Max number of “pending accept” streams that were remotely reset

§num_remote_reset_streams: usize

Current number of “pending accept” streams that were remotely reset

§max_local_error_reset_streams: Option<usize>

Maximum number of locally reset streams due to protocol error across the lifetime of the connection.

When this gets exceeded, we issue GOAWAYs.

§num_local_error_reset_streams: usize

Total number of locally reset streams due to protocol error across the lifetime of the connection.

Implementations§

source§

impl Counts

source

pub fn new(peer: Dyn, config: &Config) -> Self

Create a new Counts using the provided configuration values.

source

pub fn next_send_stream_will_reach_capacity(&self) -> bool

Returns true when the next opened stream will reach capacity of outbound streams

The number of client send streams is incremented in prioritize; send_request has to guess if it should wait before allowing another request to be sent.

source

pub fn peer(&self) -> Dyn

Returns the current peer

source

pub fn has_streams(&self) -> bool

source

pub fn can_inc_num_local_error_resets(&self) -> bool

Returns true if we can issue another local reset due to protocol error.

source

pub fn inc_num_local_error_resets(&mut self)

source

pub(crate) fn max_local_error_resets(&self) -> Option<usize>

source

pub fn can_inc_num_recv_streams(&self) -> bool

Returns true if the receive stream concurrency can be incremented

source

pub fn inc_num_recv_streams(&mut self, stream: &mut Ptr<'_>)

Increments the number of concurrent receive streams.

§Panics

Panics on failure as this should have been validated before hand.

source

pub fn can_inc_num_send_streams(&self) -> bool

Returns true if the send stream concurrency can be incremented

source

pub fn inc_num_send_streams(&mut self, stream: &mut Ptr<'_>)

Increments the number of concurrent send streams.

§Panics

Panics on failure as this should have been validated before hand.

source

pub fn can_inc_num_reset_streams(&self) -> bool

Returns true if the number of pending reset streams can be incremented.

source

pub fn inc_num_reset_streams(&mut self)

Increments the number of pending reset streams.

§Panics

Panics on failure as this should have been validated before hand.

source

pub(crate) fn max_remote_reset_streams(&self) -> usize

source

pub(crate) fn can_inc_num_remote_reset_streams(&self) -> bool

Returns true if the number of pending REMOTE reset streams can be incremented.

source

pub(crate) fn inc_num_remote_reset_streams(&mut self)

Increments the number of pending REMOTE reset streams.

§Panics

Panics on failure as this should have been validated before hand.

source

pub(crate) fn dec_num_remote_reset_streams(&mut self)

source

pub fn apply_remote_settings(&mut self, settings: &Settings)

source

pub fn transition<F, U>(&mut self, stream: Ptr<'_>, f: F) -> U
where F: FnOnce(&mut Self, &mut Ptr<'_>) -> U,

Run a block of code that could potentially transition a stream’s state.

If the stream state transitions to closed, this function will perform all necessary cleanup.

TODO: Is this function still needed?

source

pub fn transition_after(&mut self, stream: Ptr<'_>, is_reset_counted: bool)

source

pub(crate) fn max_send_streams(&self) -> usize

Returns the maximum number of streams that can be initiated by this peer.

source

pub(crate) fn max_recv_streams(&self) -> usize

Returns the maximum number of streams that can be initiated by the remote peer.

source

fn dec_num_streams(&mut self, stream: &mut Ptr<'_>)

source

fn dec_num_reset_streams(&mut self)

Trait Implementations§

source§

impl Debug for Counts

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Counts

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for Counts

§

impl RefUnwindSafe for Counts

§

impl Send for Counts

§

impl Sync for Counts

§

impl Unpin for Counts

§

impl UnwindSafe for Counts

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more