summaryrefslogtreecommitdiffstats
path: root/vendor/h2/src/proto/streams/store.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/h2/src/proto/streams/store.rs')
-rw-r--r--vendor/h2/src/proto/streams/store.rs42
1 files changed, 41 insertions, 1 deletions
diff --git a/vendor/h2/src/proto/streams/store.rs b/vendor/h2/src/proto/streams/store.rs
index d33a01cce..67b377b12 100644
--- a/vendor/h2/src/proto/streams/store.rs
+++ b/vendor/h2/src/proto/streams/store.rs
@@ -256,7 +256,7 @@ where
///
/// If the stream is already contained by the list, return `false`.
pub fn push(&mut self, stream: &mut store::Ptr) -> bool {
- tracing::trace!("Queue::push");
+ tracing::trace!("Queue::push_back");
if N::is_queued(stream) {
tracing::trace!(" -> already queued");
@@ -292,6 +292,46 @@ where
true
}
+ /// Queue the stream
+ ///
+ /// If the stream is already contained by the list, return `false`.
+ pub fn push_front(&mut self, stream: &mut store::Ptr) -> bool {
+ tracing::trace!("Queue::push_front");
+
+ if N::is_queued(stream) {
+ tracing::trace!(" -> already queued");
+ return false;
+ }
+
+ N::set_queued(stream, true);
+
+ // The next pointer shouldn't be set
+ debug_assert!(N::next(stream).is_none());
+
+ // Queue the stream
+ match self.indices {
+ Some(ref mut idxs) => {
+ tracing::trace!(" -> existing entries");
+
+ // Update the provided stream to point to the head node
+ let head_key = stream.resolve(idxs.head).key();
+ N::set_next(stream, Some(head_key));
+
+ // Update the head pointer
+ idxs.head = stream.key();
+ }
+ None => {
+ tracing::trace!(" -> first entry");
+ self.indices = Some(store::Indices {
+ head: stream.key(),
+ tail: stream.key(),
+ });
+ }
+ }
+
+ true
+ }
+
pub fn pop<'a, R>(&mut self, store: &'a mut R) -> Option<store::Ptr<'a>>
where
R: Resolve,