In oghttp2, do not deliver OnWindowUpdate() for non-existent streams.
Discovered as part of testing for b/228093860, where oghttp2 receives a
WINDOW_UPDATE on a stream that has already been closed due to RST_STREAM. This
CL increases functional parity with nghttp2.
PiperOrigin-RevId: 439692076
diff --git a/http2/adapter/oghttp2_adapter_test.cc b/http2/adapter/oghttp2_adapter_test.cc
index 9c8523c..fd572d9 100644
--- a/http2/adapter/oghttp2_adapter_test.cc
+++ b/http2/adapter/oghttp2_adapter_test.cc
@@ -1977,8 +1977,6 @@
EXPECT_CALL(visitor, OnFrameHeader(0, 4, WINDOW_UPDATE, 0));
EXPECT_CALL(visitor, OnWindowUpdate(0, 42));
EXPECT_CALL(visitor, OnFrameHeader(1, 4, WINDOW_UPDATE, 0));
- // TODO(b/228093860): Do not pass WINDOW_UPDATE events on closed streams.
- EXPECT_CALL(visitor, OnWindowUpdate(1, 42));
const int64_t stream_result = adapter->ProcessBytes(stream_frames);
EXPECT_EQ(stream_frames.size(), static_cast<size_t>(stream_result));
diff --git a/http2/adapter/oghttp2_session.cc b/http2/adapter/oghttp2_session.cc
index ed4e7fe..0381625 100644
--- a/http2/adapter/oghttp2_session.cc
+++ b/http2/adapter/oghttp2_session.cc
@@ -1373,8 +1373,9 @@
// Receiving WINDOW_UPDATE before HEADERS is a connection error.
LatchErrorAndNotify(Http2ErrorCode::PROTOCOL_ERROR,
ConnectionError::kWrongFrameSequence);
- return;
}
+ // Do not inform the visitor of a WINDOW_UPDATE for a non-existent stream.
+ return;
} else {
if (streams_reset_.contains(stream_id)) {
return;