From 2dca78766a968d7b17532bd970586fe1dcac2bd2 Mon Sep 17 00:00:00 2001 From: Benjamin Saunders Date: Sun, 13 Nov 2022 10:42:11 -0800 Subject: [PATCH] Less confusing Notify name for local stream opening Remotely-initiated streams can be said to be opened as well. --- quinn/src/connection.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/quinn/src/connection.rs b/quinn/src/connection.rs index 2d38e21bb..9a338a6c0 100644 --- a/quinn/src/connection.rs +++ b/quinn/src/connection.rs @@ -273,7 +273,7 @@ impl Connection { pub fn open_uni(&self) -> OpenUni<'_> { OpenUni { conn: &self.0, - notify: self.0.shared.stream_opening[Dir::Uni as usize].notified(), + notify: self.0.shared.stream_budget_available[Dir::Uni as usize].notified(), } } @@ -285,7 +285,7 @@ impl Connection { pub fn open_bi(&self) -> OpenBi<'_> { OpenBi { conn: &self.0, - notify: self.0.shared.stream_opening[Dir::Bi as usize].notified(), + notify: self.0.shared.stream_budget_available[Dir::Bi as usize].notified(), } } @@ -628,7 +628,9 @@ fn poll_open<'a>( // `state` lock ensures we didn't race with readiness Poll::Pending => return Poll::Pending, // Spurious wakeup, get a new future - Poll::Ready(()) => notify.set(conn.shared.stream_opening[dir as usize].notified()), + Poll::Ready(()) => { + notify.set(conn.shared.stream_budget_available[dir as usize].notified()) + } } } } @@ -815,7 +817,7 @@ pub struct ConnectionInner { pub(crate) struct Shared { /// Notified when new streams may be locally initiated due to an increase in stream ID flow /// control budget - stream_opening: [Notify; 2], + stream_budget_available: [Notify; 2], /// Notified when the peer has initiated a new stream stream_incoming: [Notify; 2], datagrams: Notify, @@ -954,7 +956,7 @@ impl State { } Stream(StreamEvent::Available { dir }) => { // Might mean any number of streams are ready, so we wake up everyone - shared.stream_opening[dir as usize].notify_waiters(); + shared.stream_budget_available[dir as usize].notify_waiters(); } Stream(StreamEvent::Finished { id }) => { if let Some(finishing) = self.finishing.remove(&id) { @@ -1046,8 +1048,8 @@ impl State { for (_, reader) in self.blocked_readers.drain() { reader.wake() } - shared.stream_opening[Dir::Uni as usize].notify_waiters(); - shared.stream_opening[Dir::Bi as usize].notify_waiters(); + shared.stream_budget_available[Dir::Uni as usize].notify_waiters(); + shared.stream_budget_available[Dir::Bi as usize].notify_waiters(); shared.stream_incoming[Dir::Uni as usize].notify_waiters(); shared.stream_incoming[Dir::Bi as usize].notify_waiters(); shared.datagrams.notify_waiters();