Prevent QuicStreamSequencer from taking in new data after the stream is reset.
gfe-relnote: Protected by gfe2_reloadable_flag_quic_no_stream_data_after_reset.
PiperOrigin-RevId: 263184076
Change-Id: I7300945bcb0bc54fc3bdd8dbafb7c8669e97afd2
diff --git a/quic/core/quic_stream_sequencer.cc b/quic/core/quic_stream_sequencer.cc
index 5064bbb..fb89821 100644
--- a/quic/core/quic_stream_sequencer.cc
+++ b/quic/core/quic_stream_sequencer.cc
@@ -16,6 +16,7 @@
#include "net/third_party/quiche/src/quic/platform/api/quic_bug_tracker.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_clock.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_flag_utils.h"
+#include "net/third_party/quiche/src/quic/platform/api/quic_flags.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_logging.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_str_cat.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
@@ -42,10 +43,16 @@
const size_t data_len = frame.data_length;
if (frame.fin) {
- CloseStreamAtOffset(frame.offset + data_len);
+ bool should_process_data = CloseStreamAtOffset(frame.offset + data_len);
if (data_len == 0) {
return;
}
+ if (GetQuicReloadableFlag(quic_no_stream_data_after_reset)) {
+ QUIC_RELOADABLE_FLAG_COUNT(quic_no_stream_data_after_reset);
+ if (!should_process_data) {
+ return;
+ }
+ }
}
OnFrameData(byte_offset, data_len, frame.data_buffer);
}
@@ -109,19 +116,20 @@
}
}
-void QuicStreamSequencer::CloseStreamAtOffset(QuicStreamOffset offset) {
+bool QuicStreamSequencer::CloseStreamAtOffset(QuicStreamOffset offset) {
const QuicStreamOffset kMaxOffset =
std::numeric_limits<QuicStreamOffset>::max();
// If there is a scheduled close, the new offset should match it.
if (close_offset_ != kMaxOffset && offset != close_offset_) {
stream_->Reset(QUIC_MULTIPLE_TERMINATION_OFFSETS);
- return;
+ return false;
}
close_offset_ = offset;
MaybeCloseStream();
+ return true;
}
void QuicStreamSequencer::MaybeCloseStream() {