Skip to content

Commit

Permalink
DO NOT MERGE: Debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralith committed Sep 18, 2022
1 parent af3f607 commit df65cd7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions quinn/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ impl Connection {
/// consequence, the peer won't be notified that a stream has been opened until the stream is
/// actually used.
pub fn open_bi(&self) -> OpenBi<'_> {
tracing::error!("open bi");
OpenBi {
conn: Some(self.0.clone()),
notify: self.0.shared.stream_opening[Dir::Bi as usize].notified(),
Expand Down Expand Up @@ -650,18 +651,23 @@ fn poll_open(
notify: Pin<&mut Notified<'_>>,
dir: Dir,
) -> Poll<Result<(ConnectionRef, StreamId, bool), ConnectionError>> {
tracing::error!("poll");
let mut conn = conn_storage.as_ref().unwrap().state.lock("poll_open");
if let Some(ref e) = conn.error {
Poll::Ready(Err(e.clone()))
} else if let Some(id) = conn.inner.streams().open(dir) {
let is_0rtt = conn.inner.side().is_client() && conn.inner.is_handshaking();
drop(conn); // Release the borrow so it can be passed to `RecvStream`
let conn = conn_storage.take().expect("polled after completion");
tracing::error!("stream consumed");
Poll::Ready(Ok((conn, id, is_0rtt)))
} else if notify.poll(ctx).is_pending() {
tracing::error!("stream pending");
// `conn` lock ensures we don't race with readiness
Poll::Pending
} else {
tracing::error!("open notified prematurely");
drop(conn);
unreachable!("Open notified without stream open credit available");
}
}
Expand Down Expand Up @@ -840,6 +846,7 @@ impl Future for ReadDatagram<'_> {
// `conn` lock ensures we don't race with readiness
Poll::Pending
} else {
drop(conn);
unreachable!("ReadDatagram notified with no datagrams pending");
}
}
Expand Down Expand Up @@ -1119,6 +1126,7 @@ impl State {
}
}
Stream(StreamEvent::Available { dir }) => {
tracing::error!("stream available");
shared.stream_opening[dir as usize].notify_one();
}
Stream(StreamEvent::Finished { id }) => {
Expand Down Expand Up @@ -1211,6 +1219,7 @@ impl State {
for (_, reader) in self.blocked_readers.drain() {
reader.wake()
}
tracing::error!("terminate");
shared.stream_opening[Dir::Uni as usize].notify_waiters();
shared.stream_opening[Dir::Bi as usize].notify_waiters();
shared.stream_incoming[Dir::Uni as usize].notify_waiters();
Expand Down

0 comments on commit df65cd7

Please sign in to comment.