Skip to content

Commit

Permalink
h3: avoid unnecessary work on control streams
Browse files Browse the repository at this point in the history
Previously, quiche's poll() function would attempt to do work on control or
QPACK streams, whether they were readable or not. Since we encourage apps to
call poll() after each read loop, this could result in wasted work.

With this change, we'll return early if the stream is not actually readable.
  • Loading branch information
LPardue authored Sep 10, 2024
1 parent 6f92884 commit a5fa399
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions quiche/src/h3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2130,6 +2130,10 @@ impl Connection {
return Err(Error::ClosedCriticalStream);
}

if !conn.stream_readable(stream_id) {
return Err(Error::Done);
}

match self.process_readable_stream(conn, stream_id, true) {
Ok(ev) => return Ok(ev),

Expand Down

0 comments on commit a5fa399

Please sign in to comment.