From 18d8dbe1d4a5d90ab06ddba455c41c9f7cb65104 Mon Sep 17 00:00:00 2001 From: Ulrik Date: Sun, 6 Feb 2022 21:09:36 +0100 Subject: [PATCH] State::send_open:Add `final_response` indicating if more headers will come --- src/proto/streams/send.rs | 3 ++- src/proto/streams/state.rs | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/proto/streams/send.rs b/src/proto/streams/send.rs index 2a7abba0..a950a3f3 100644 --- a/src/proto/streams/send.rs +++ b/src/proto/streams/send.rs @@ -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 { diff --git a/src/proto/streams/state.rs b/src/proto/streams/state.rs index 3bdd6bfe..ae534231 100644 --- a/src/proto/streams/state.rs +++ b/src/proto/streams/state.rs @@ -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 => {