Skip to content

Commit

Permalink
h3: set stream priority after headers buffered
Browse files Browse the repository at this point in the history
send_headers() can fail if there is not enough stream capacity to buffer
encoded headers and applications are expected to try again later.
Previously, send_response_with_priority() would update
the stream priority prior to send_headers(), which might surprise
some types of applications relying on the writable() iterator.

This change swaps the ordering around so that priority is only changed
after headers have been successfully buffered.
  • Loading branch information
LPardue authored and ghedo committed May 20, 2024
1 parent 3de33b9 commit 8420d27
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions quiche/src/h3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,8 @@ impl Connection {
return Err(Error::FrameUnexpected);
}

self.send_headers(conn, stream_id, headers, fin)?;

// Clamp and shift urgency into quiche-priority space
let urgency = priority
.urgency
Expand All @@ -1172,8 +1174,6 @@ impl Connection {

conn.stream_priority(stream_id, urgency, priority.incremental)?;

self.send_headers(conn, stream_id, headers, fin)?;

Ok(())
}

Expand Down

0 comments on commit 8420d27

Please sign in to comment.