Replace gfe2_reloadable_flag_quic_split_up_send_rst with gfe2_reloadable_flag_quic_split_up_send_rst_2. Under the new flag, it's guaranteed that STOP_SENDING and RESET_STREAM will be sent in the same packet. Protected by quic_reloadable_flag_quic_split_up_send_rst_2. PiperOrigin-RevId: 341508593 Change-Id: Ida6350ef5657680d959792ea758c7f849337109a
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc index 91e3dd1..a648c69 100644 --- a/quic/core/http/end_to_end_test.cc +++ b/quic/core/http/end_to_end_test.cc
@@ -2381,7 +2381,20 @@ // Transmit the cancel, and ensure the connection is torn down properly. SetPacketLossPercentage(0); QuicStreamId stream_id = GetNthClientInitiatedBidirectionalId(0); + QuicConnection* client_connection = GetClientConnection(); + ASSERT_TRUE(client_connection); + const QuicPacketCount packets_sent_before = + client_connection->GetStats().packets_sent; session->ResetStream(stream_id, QUIC_STREAM_CANCELLED); + const QuicPacketCount packets_sent_now = + client_connection->GetStats().packets_sent; + + if (version_.UsesHttp3() && + absl::GetFlag(FLAGS_gfe2_reloadable_flag_quic_split_up_send_rst_2)) { + // Make sure 2 packets were sent, one for QPACK instructions, another for + // RESET_STREAM and STOP_SENDING. + EXPECT_EQ(packets_sent_before + 2, packets_sent_now); + } // WaitForEvents waits 50ms and returns true if there are outstanding // requests.
diff --git a/quic/core/quic_flags_list.h b/quic/core/quic_flags_list.h index 6c87293..7b02787 100644 --- a/quic/core/quic_flags_list.h +++ b/quic/core/quic_flags_list.h
@@ -68,7 +68,7 @@ QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_send_path_response, false) QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_send_timestamps, false) QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_send_version_negotiation_for_short_connection_ids, false) -QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_split_up_send_rst, false) +QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_split_up_send_rst_2, false) QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_start_peer_migration_earlier, false) QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_stop_sending_uses_ietf_error_code, true) QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_testonly_default_false, false)
diff --git a/quic/core/quic_session.h b/quic/core/quic_session.h index 775c717..e454892 100644 --- a/quic/core/quic_session.h +++ b/quic/core/quic_session.h
@@ -221,7 +221,7 @@ // Called by stream to send RST_STREAM (and STOP_SENDING in IETF QUIC). // if |send_rst_only|, STOP_SENDING will not be sent for IETF QUIC. - // TODO(b/170233449): Delete this method when flag quic_split_up_send_rst is + // TODO(b/170233449): Delete this method when flag quic_split_up_send_rst_2 is // deprecated. virtual void SendRstStream(QuicStreamId id, QuicRstStreamErrorCode error, @@ -860,7 +860,8 @@ // creation of new outgoing bidirectional streams. bool liveness_testing_in_progress_; - const bool split_up_send_rst_ = GetQuicReloadableFlag(quic_split_up_send_rst); + const bool split_up_send_rst_ = + GetQuicReloadableFlag(quic_split_up_send_rst_2); const bool use_write_or_buffer_data_at_level_ = GetQuicReloadableFlag(quic_use_write_or_buffer_data_at_level);
diff --git a/quic/core/quic_stream.cc b/quic/core/quic_stream.cc index 7a177d4..aaef261 100644 --- a/quic/core/quic_stream.cc +++ b/quic/core/quic_stream.cc
@@ -499,7 +499,7 @@ stream_error_ = code; if (session()->split_up_send_rst()) { - QUIC_RELOADABLE_FLAG_COUNT_N(quic_split_up_send_rst, 1, 3); + QUIC_RELOADABLE_FLAG_COUNT_N(quic_split_up_send_rst_2, 1, 3); MaybeSendRstStream(code); } else { session()->SendRstStream(id(), code, stream_bytes_written(), @@ -593,7 +593,8 @@ void QuicStream::Reset(QuicRstStreamErrorCode error) { stream_error_ = error; if (session()->split_up_send_rst()) { - QUIC_RELOADABLE_FLAG_COUNT_N(quic_split_up_send_rst, 2, 3); + QUIC_RELOADABLE_FLAG_COUNT_N(quic_split_up_send_rst_2, 2, 3); + QuicConnection::ScopedPacketFlusher flusher(session()->connection()); MaybeSendStopSending(error); MaybeSendRstStream(error); } else { @@ -925,7 +926,7 @@ session_->MaybeCloseZombieStream(id_); rst_sent_ = true; } else { - QUIC_RELOADABLE_FLAG_COUNT_N(quic_split_up_send_rst, 3, 3); + QUIC_RELOADABLE_FLAG_COUNT_N(quic_split_up_send_rst_2, 3, 3); QUIC_BUG_IF(session()->connection()->connected() && session()->version().UsesHttp3()) << "The stream should've already sent RST in response to "
diff --git a/quic/qbone/qbone_stream_test.cc b/quic/qbone/qbone_stream_test.cc index 17cd2e1..18f48f7 100644 --- a/quic/qbone/qbone_stream_test.cc +++ b/quic/qbone/qbone_stream_test.cc
@@ -57,9 +57,6 @@ return nullptr; } - const QuicCryptoStream* GetCryptoStream() const override { return nullptr; } - QuicCryptoStream* GetMutableCryptoStream() override { return nullptr; } - // Called by QuicStream when they want to close stream. MOCK_METHOD(void, SendRstStream, @@ -95,7 +92,7 @@ } std::unique_ptr<QuicCryptoStream> CreateCryptoStream() override { - return nullptr; + return std::make_unique<test::MockQuicCryptoStream>(this); } MOCK_METHOD(void, ProcessPacketFromPeer, (absl::string_view), (override)); @@ -162,6 +159,7 @@ clock_.AdvanceTime(QuicTime::Delta::FromSeconds(1)); session_ = std::make_unique<StrictMock<MockQuicSession>>(connection_.get(), QuicConfig()); + session_->Initialize(); stream_ = new QboneReadOnlyStream(kStreamId, session_.get()); session_->ActivateReliableStream( std::unique_ptr<QboneReadOnlyStream>(stream_));