/// 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. pubfn next_send_stream_will_reach_capacity(&self) -> bool { self.max_send_streams <= (self.num_send_streams + 1)
}
/// Returns the current peer pubfn peer(&self) -> peer::Dyn { self.peer
}
/// Returns true if the receive stream concurrency can be incremented pubfn can_inc_num_recv_streams(&self) -> bool { self.max_recv_streams > self.num_recv_streams
}
/// Increments the number of concurrent receive streams. /// /// # Panics /// /// Panics on failure as this should have been validated before hand. pubfn inc_num_recv_streams(&mutself, stream: &mut store::Ptr) {
assert!(self.can_inc_num_recv_streams());
assert!(!stream.is_counted);
// Increment the number of remote initiated streams self.num_recv_streams += 1;
stream.is_counted = true;
}
/// Returns true if the send stream concurrency can be incremented pubfn can_inc_num_send_streams(&self) -> bool { self.max_send_streams > self.num_send_streams
}
/// Increments the number of concurrent send streams. /// /// # Panics /// /// Panics on failure as this should have been validated before hand. pubfn inc_num_send_streams(&mutself, stream: &mut store::Ptr) {
assert!(self.can_inc_num_send_streams());
assert!(!stream.is_counted);
// Increment the number of remote initiated streams self.num_send_streams += 1;
stream.is_counted = true;
}
/// Returns true if the number of pending reset streams can be incremented. pubfn can_inc_num_reset_streams(&self) -> bool { self.max_local_reset_streams > self.num_local_reset_streams
}
/// Increments the number of pending reset streams. /// /// # Panics /// /// Panics on failure as this should have been validated before hand. pubfn inc_num_reset_streams(&mutself) {
assert!(self.can_inc_num_reset_streams());
/// Returns true if the number of pending REMOTE reset streams can be /// incremented. pub(crate) fn can_inc_num_remote_reset_streams(&self) -> bool { self.max_remote_reset_streams > self.num_remote_reset_streams
}
/// Increments the number of pending REMOTE reset streams. /// /// # Panics /// /// Panics on failure as this should have been validated before hand. pub(crate) fn inc_num_remote_reset_streams(&mutself) {
assert!(self.can_inc_num_remote_reset_streams());
pubfn apply_remote_settings(&mutself, settings: &frame::Settings) { iflet Some(val) = settings.max_concurrent_streams() { self.max_send_streams = val as usize;
}
}
/// 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? pubfn transition<F, U>(&mutself, mut stream: store::Ptr, f: F) -> U where
F: FnOnce(&mutSelf, &mut store::Ptr) -> U,
{ // TODO: Does this need to be computed before performing the action? let is_pending_reset = stream.is_pending_reset_expiration();
if stream.is_closed() { if !stream.is_pending_reset_expiration() {
stream.unlink(); if is_reset_counted { self.dec_num_reset_streams();
}
}
if stream.is_counted {
tracing::trace!("dec_num_streams; stream={:?}", stream.id); // Decrement the number of active streams. self.dec_num_streams(&mut stream);
}
}
// Release the stream if it requires releasing if stream.is_released() {
stream.remove();
}
}
/// Returns the maximum number of streams that can be initiated by this /// peer. pub(crate) fn max_send_streams(&self) -> usize { self.max_send_streams
}
/// Returns the maximum number of streams that can be initiated by the /// remote peer. pub(crate) fn max_recv_streams(&self) -> usize { self.max_recv_streams
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.