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 Feb 6, 2022
1 parent 657bcb4 commit 9dde7e1
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)?;

if counts.peer().is_local_init(frame.stream_id()) {
// If we're waiting on a PushPromise anyway
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 @@ -87,8 +87,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 9dde7e1

Please sign in to comment.