Skip to content

Commit

Permalink
State::send_open:Add final_response indicating if more headers will…
Browse files Browse the repository at this point in the history
… come
  • Loading branch information
rawler committed Oct 13, 2024
1 parent 6591cea commit 18d8dbe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/proto/streams/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,11 @@ impl Send {

Self::check_headers(frame.fields())?;

let final_response = !frame.is_informational();
let end_stream = frame.is_end_stream();

// Update the state
stream.state.send_open(end_stream)?;
stream.state.send_open(final_response, end_stream)?;

let mut pending_open = false;
if counts.peer().is_local_init(frame.stream_id()) && !stream.is_pending_push {
Expand Down
8 changes: 6 additions & 2 deletions src/proto/streams/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ enum Cause {

impl State {
/// Opens the send-half of a stream if it is not already open.
pub fn send_open(&mut self, eos: bool) -> Result<(), UserError> {
let local = Streaming;
pub fn send_open(&mut self, final_response: bool, eos: bool) -> Result<(), UserError> {
let local = if final_response {
Streaming
} else {
AwaitingHeaders
};

self.inner = match self.inner {
Idle => {
Expand Down

0 comments on commit 18d8dbe

Please sign in to comment.