Skip to content

Commit

Permalink
Less confusing Notify name for local stream opening
Browse files Browse the repository at this point in the history
Remotely-initiated streams can be said to be opened as well.
  • Loading branch information
Ralith committed Nov 14, 2022
1 parent d73fcfd commit 2dca787
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions quinn/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}

Expand All @@ -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(),
}
}

Expand Down Expand Up @@ -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())
}
}
}
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 2dca787

Please sign in to comment.