Skip to content

Commit dad7572

Browse files
committed
Fix RecvStream::is_end_stream(): return true only when END_STREAM is received
Before this change, it returned true on other types of disconnection as well. Fixes hyperium#806
1 parent 848885b commit dad7572

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

src/proto/streams/recv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ impl Recv {
557557
}
558558

559559
pub fn is_end_stream(&self, stream: &store::Ptr) -> bool {
560-
if !stream.state.is_recv_closed() {
560+
if !stream.state.is_end_stream() {
561561
return false;
562562
}
563563

src/proto/streams/state.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,8 @@ impl State {
413413
matches!(self.inner, Closed(_))
414414
}
415415

416-
pub fn is_recv_closed(&self) -> bool {
417-
matches!(
418-
self.inner,
419-
Closed(..) | HalfClosedRemote(..) | ReservedLocal
420-
)
416+
pub fn is_end_stream(&self) -> bool {
417+
matches!(self.inner, Closed(Cause::EndStream))
421418
}
422419

423420
pub fn is_send_closed(&self) -> bool {

tests/h2-tests/tests/flow_control.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ async fn client_decrease_initial_window_size() {
13391339
conn.drive(async {
13401340
data(&mut body5, "body5 data2").await;
13411341
data(&mut body5, "body5 data3").await;
1342-
assert!(body3.is_end_stream());
1342+
assert!(!body3.is_end_stream());
13431343
})
13441344
.await;
13451345

0 commit comments

Comments
 (0)