pub(super) struct Recv {Show 14 fields
init_window_sz: u32,
flow: FlowControl,
in_flight_data: u32,
next_stream_id: Result<StreamId, StreamIdOverflow>,
last_processed_id: StreamId,
max_stream_id: StreamId,
pending_window_updates: Queue<NextWindowUpdate>,
pending_accept: Queue<NextAccept>,
pending_reset_expired: Queue<NextResetExpire>,
reset_duration: Duration,
buffer: Buffer<Event>,
refused: Option<StreamId>,
is_push_enabled: bool,
is_extended_connect_protocol_enabled: bool,
}
Fields§
§init_window_sz: u32
Initial window size of remote initiated streams
flow: FlowControl
Connection level flow control governing received data
in_flight_data: u32
Amount of connection window capacity currently used by outstanding streams.
next_stream_id: Result<StreamId, StreamIdOverflow>
The lowest stream ID that is still idle
last_processed_id: StreamId
The stream ID of the last processed stream
max_stream_id: StreamId
Any streams with a higher ID are ignored.
This starts as MAX, but is lowered when a GOAWAY is received.
After sending a GOAWAY frame, the sender can discard frames for streams initiated by the receiver with identifiers higher than the identified last stream.
pending_window_updates: Queue<NextWindowUpdate>
Streams that have pending window updates
pending_accept: Queue<NextAccept>
New streams to be accepted
pending_reset_expired: Queue<NextResetExpire>
Locally reset streams that should be reaped when they expire
reset_duration: Duration
How long locally reset streams should ignore received frames
buffer: Buffer<Event>
Holds frames that are waiting to be read
refused: Option<StreamId>
Refused StreamId, this represents a frame that must be sent out.
is_push_enabled: bool
If push promises are allowed to be received.
is_extended_connect_protocol_enabled: bool
If extended connect protocol is enabled.
Implementations§
source§impl Recv
impl Recv
pub fn new(peer: Dyn, config: &Config) -> Self
sourcepub fn init_window_sz(&self) -> u32
pub fn init_window_sz(&self) -> u32
Returns the initial receive window size
sourcepub fn last_processed_id(&self) -> StreamId
pub fn last_processed_id(&self) -> StreamId
Returns the ID of the last processed stream
sourcepub fn open(
&mut self,
id: StreamId,
mode: Open,
counts: &mut Counts,
) -> Result<Option<StreamId>, Error>
pub fn open( &mut self, id: StreamId, mode: Open, counts: &mut Counts, ) -> Result<Option<StreamId>, Error>
Update state reflecting a new, remotely opened stream
Returns the stream state if successful. None
if refused
sourcepub fn recv_headers(
&mut self,
frame: Headers,
stream: &mut Ptr<'_>,
counts: &mut Counts,
) -> Result<(), RecvHeaderBlockError<Option<Headers>>>
pub fn recv_headers( &mut self, frame: Headers, stream: &mut Ptr<'_>, counts: &mut Counts, ) -> Result<(), RecvHeaderBlockError<Option<Headers>>>
Transition the stream state based on receiving headers
The caller ensures that the frame represents headers and not trailers.
sourcepub fn take_request(&mut self, stream: &mut Ptr<'_>) -> Request<()>
pub fn take_request(&mut self, stream: &mut Ptr<'_>) -> Request<()>
Called by the server to get the request
§Panics
Panics if stream.pending_recv
has no Event::Headers
queued.
sourcepub fn poll_pushed(
&mut self,
cx: &Context<'_>,
stream: &mut Ptr<'_>,
) -> Poll<Option<Result<(Request<()>, Key), Error>>>
pub fn poll_pushed( &mut self, cx: &Context<'_>, stream: &mut Ptr<'_>, ) -> Poll<Option<Result<(Request<()>, Key), Error>>>
Called by the client to get pushed response
sourcepub fn poll_response(
&mut self,
cx: &Context<'_>,
stream: &mut Ptr<'_>,
) -> Poll<Result<Response<()>, Error>>
pub fn poll_response( &mut self, cx: &Context<'_>, stream: &mut Ptr<'_>, ) -> Poll<Result<Response<()>, Error>>
Called by the client to get the response
sourcepub fn recv_trailers(
&mut self,
frame: Headers,
stream: &mut Ptr<'_>,
) -> Result<(), Error>
pub fn recv_trailers( &mut self, frame: Headers, stream: &mut Ptr<'_>, ) -> Result<(), Error>
Transition the stream based on receiving trailers
sourcepub fn release_connection_capacity(
&mut self,
capacity: u32,
task: &mut Option<Waker>,
)
pub fn release_connection_capacity( &mut self, capacity: u32, task: &mut Option<Waker>, )
Releases capacity of the connection
sourcepub fn release_capacity(
&mut self,
capacity: u32,
stream: &mut Ptr<'_>,
task: &mut Option<Waker>,
) -> Result<(), UserError>
pub fn release_capacity( &mut self, capacity: u32, stream: &mut Ptr<'_>, task: &mut Option<Waker>, ) -> Result<(), UserError>
Releases capacity back to the connection & stream
sourcepub fn release_closed_capacity(
&mut self,
stream: &mut Ptr<'_>,
task: &mut Option<Waker>,
)
pub fn release_closed_capacity( &mut self, stream: &mut Ptr<'_>, task: &mut Option<Waker>, )
Release any unclaimed capacity for a closed stream.
sourcepub fn set_target_connection_window(
&mut self,
target: u32,
task: &mut Option<Waker>,
) -> Result<(), Reason>
pub fn set_target_connection_window( &mut self, target: u32, task: &mut Option<Waker>, ) -> Result<(), Reason>
Set the “target” connection window size.
By default, all new connections start with 64kb of window size. As streams used and release capacity, we will send WINDOW_UPDATEs for the connection to bring it back up to the initial “target”.
Setting a target means that we will try to tell the peer about
WINDOW_UPDATEs so the peer knows it has about target
window to use
for the whole connection.
The task
is an optional parked task for the Connection
that might
be blocked on needing more window capacity.
pub(crate) fn apply_local_settings( &mut self, settings: &Settings, store: &mut Store, ) -> Result<(), Error>
pub fn is_end_stream(&self, stream: &Ptr<'_>) -> bool
pub fn recv_data( &mut self, frame: Data, stream: &mut Ptr<'_>, ) -> Result<(), Error>
pub fn ignore_data(&mut self, sz: u32) -> Result<(), Error>
pub fn consume_connection_window(&mut self, sz: u32) -> Result<(), Error>
pub fn recv_push_promise( &mut self, frame: PushPromise, stream: &mut Ptr<'_>, ) -> Result<(), Error>
sourcepub fn ensure_not_idle(&self, id: StreamId) -> Result<(), Reason>
pub fn ensure_not_idle(&self, id: StreamId) -> Result<(), Reason>
Ensures that id
is not in the Idle
state.
sourcepub fn recv_reset(
&mut self,
frame: Reset,
stream: &mut Stream,
counts: &mut Counts,
) -> Result<(), Error>
pub fn recv_reset( &mut self, frame: Reset, stream: &mut Stream, counts: &mut Counts, ) -> Result<(), Error>
Handle remote sending an explicit RST_STREAM.
sourcepub fn handle_error(&mut self, err: &Error, stream: &mut Stream)
pub fn handle_error(&mut self, err: &Error, stream: &mut Stream)
Handle a connection-level error
pub fn go_away(&mut self, last_processed_id: StreamId)
pub fn recv_eof(&mut self, stream: &mut Stream)
pub(super) fn clear_recv_buffer(&mut self, stream: &mut Stream)
sourcepub fn max_stream_id(&self) -> StreamId
pub fn max_stream_id(&self) -> StreamId
Get the max ID of streams we can receive.
This gets lowered if we send a GOAWAY frame.
pub fn next_stream_id(&self) -> Result<StreamId, Error>
pub fn may_have_created_stream(&self, id: StreamId) -> bool
pub(super) fn maybe_reset_next_stream_id(&mut self, id: StreamId)
sourcepub fn ensure_can_reserve(&self) -> Result<(), Error>
pub fn ensure_can_reserve(&self) -> Result<(), Error>
Returns true if the remote peer can reserve a stream with the given ID.
sourcepub fn enqueue_reset_expiration(
&mut self,
stream: &mut Ptr<'_>,
counts: &mut Counts,
)
pub fn enqueue_reset_expiration( &mut self, stream: &mut Ptr<'_>, counts: &mut Counts, )
Add a locally reset stream to queue to be eventually reaped.
sourcepub fn send_pending_refusal<T, B>(
&mut self,
cx: &mut Context<'_>,
dst: &mut Codec<T, Prioritized<B>>,
) -> Poll<Result<()>>
pub fn send_pending_refusal<T, B>( &mut self, cx: &mut Context<'_>, dst: &mut Codec<T, Prioritized<B>>, ) -> Poll<Result<()>>
Send any pending refusals.
pub fn clear_expired_reset_streams( &mut self, store: &mut Store, counts: &mut Counts, )
pub fn clear_queues( &mut self, clear_pending_accept: bool, store: &mut Store, counts: &mut Counts, )
fn clear_stream_window_update_queue( &mut self, store: &mut Store, counts: &mut Counts, )
sourcefn clear_all_reset_streams(&mut self, store: &mut Store, counts: &mut Counts)
fn clear_all_reset_streams(&mut self, store: &mut Store, counts: &mut Counts)
Called on EOF
fn clear_all_pending_accept(&mut self, store: &mut Store, counts: &mut Counts)
pub fn poll_complete<T, B>( &mut self, cx: &mut Context<'_>, store: &mut Store, counts: &mut Counts, dst: &mut Codec<T, Prioritized<B>>, ) -> Poll<Result<()>>
sourcefn send_connection_window_update<T, B>(
&mut self,
cx: &mut Context<'_>,
dst: &mut Codec<T, Prioritized<B>>,
) -> Poll<Result<()>>
fn send_connection_window_update<T, B>( &mut self, cx: &mut Context<'_>, dst: &mut Codec<T, Prioritized<B>>, ) -> Poll<Result<()>>
Send connection level window update
sourcepub fn send_stream_window_updates<T, B>(
&mut self,
cx: &mut Context<'_>,
store: &mut Store,
counts: &mut Counts,
dst: &mut Codec<T, Prioritized<B>>,
) -> Poll<Result<()>>
pub fn send_stream_window_updates<T, B>( &mut self, cx: &mut Context<'_>, store: &mut Store, counts: &mut Counts, dst: &mut Codec<T, Prioritized<B>>, ) -> Poll<Result<()>>
Send stream level window update