deprecate gfe2_reloadable_flag_quic_split_up_send_rst_2. PiperOrigin-RevId: 355190869 Change-Id: Ibb80955ad0719724682060689bc2ba71346ddb0d
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc index 887e0eb..357ac69 100644 --- a/quic/core/http/end_to_end_test.cc +++ b/quic/core/http/end_to_end_test.cc
@@ -2437,7 +2437,7 @@ const QuicPacketCount packets_sent_now = client_connection->GetStats().packets_sent; - if (version_.UsesHttp3() && GetQuicReloadableFlag(quic_split_up_send_rst_2)) { + if (version_.UsesHttp3()) { // 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);
diff --git a/quic/core/http/quic_spdy_server_stream_base.cc b/quic/core/http/quic_spdy_server_stream_base.cc index d6cbddf..c2e7845 100644 --- a/quic/core/http/quic_spdy_server_stream_base.cc +++ b/quic/core/http/quic_spdy_server_stream_base.cc
@@ -28,11 +28,7 @@ QUICHE_DCHECK(fin_sent() || !session()->connection()->connected()); // Tell the peer to stop sending further data. QUIC_DVLOG(1) << " Server: Send QUIC_STREAM_NO_ERROR on stream " << id(); - if (session()->split_up_send_rst()) { - MaybeSendStopSending(QUIC_STREAM_NO_ERROR); - } else { - Reset(QUIC_STREAM_NO_ERROR); - } + MaybeSendStopSending(QUIC_STREAM_NO_ERROR); } QuicSpdyStream::CloseWriteSide(); @@ -44,11 +40,7 @@ QUICHE_DCHECK(fin_sent()); // Tell the peer to stop sending further data. QUIC_DVLOG(1) << " Server: Send QUIC_STREAM_NO_ERROR on stream " << id(); - if (session()->split_up_send_rst()) { - MaybeSendStopSending(QUIC_STREAM_NO_ERROR); - } else { - Reset(QUIC_STREAM_NO_ERROR); - } + MaybeSendStopSending(QUIC_STREAM_NO_ERROR); } QuicSpdyStream::StopReading(); }
diff --git a/quic/core/http/quic_spdy_server_stream_base_test.cc b/quic/core/http/quic_spdy_server_stream_base_test.cc index 323e4d2..bada263 100644 --- a/quic/core/http/quic_spdy_server_stream_base_test.cc +++ b/quic/core/http/quic_spdy_server_stream_base_test.cc
@@ -55,17 +55,12 @@ SendQuicRstStreamNoErrorWithEarlyResponse) { stream_->StopReading(); - if (!session_.split_up_send_rst()) { - EXPECT_CALL(session_, SendRstStream(_, QUIC_STREAM_NO_ERROR, _, _)) + if (session_.version().UsesHttp3()) { + EXPECT_CALL(session_, MaybeSendStopSendingFrame(_, QUIC_STREAM_NO_ERROR)) .Times(1); } else { - if (session_.version().UsesHttp3()) { - EXPECT_CALL(session_, MaybeSendStopSendingFrame(_, QUIC_STREAM_NO_ERROR)) - .Times(1); - } else { - EXPECT_CALL(session_, MaybeSendRstStreamFrame(_, QUIC_STREAM_NO_ERROR, _)) - .Times(1); - } + EXPECT_CALL(session_, MaybeSendRstStreamFrame(_, QUIC_STREAM_NO_ERROR, _)) + .Times(1); } QuicStreamPeer::SetFinSent(stream_); stream_->CloseWriteSide(); @@ -75,27 +70,14 @@ DoNotSendQuicRstStreamNoErrorWithRstReceived) { EXPECT_FALSE(stream_->reading_stopped()); - EXPECT_CALL(session_, SendRstStream(_, QUIC_STREAM_NO_ERROR, _, _)).Times(0); - - if (!session_.split_up_send_rst()) { - EXPECT_CALL( - session_, - SendRstStream(_, - VersionHasIetfQuicFrames(session_.transport_version()) - ? QUIC_STREAM_CANCELLED - : QUIC_RST_ACKNOWLEDGEMENT, - _, _)) - .Times(1); - } else { - EXPECT_CALL(session_, - MaybeSendRstStreamFrame( - _, - VersionHasIetfQuicFrames(session_.transport_version()) - ? QUIC_STREAM_CANCELLED - : QUIC_RST_ACKNOWLEDGEMENT, - _)) - .Times(1); - } + EXPECT_CALL(session_, + MaybeSendRstStreamFrame( + _, + VersionHasIetfQuicFrames(session_.transport_version()) + ? QUIC_STREAM_CANCELLED + : QUIC_RST_ACKNOWLEDGEMENT, + _)) + .Times(1); QuicRstStreamFrame rst_frame(kInvalidControlFrameId, stream_->id(), QUIC_STREAM_CANCELLED, 1234); stream_->OnStreamReset(rst_frame);
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc index 14f3eab..06f779e 100644 --- a/quic/core/http/quic_spdy_stream_test.cc +++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -520,13 +520,8 @@ stream_->OnStreamHeadersPriority( spdy::SpdyStreamPrecedence(kV3HighestPriority)); - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, - SendRstStream(stream_->id(), QUIC_HEADERS_TOO_LARGE, 0, _)); - } else { - EXPECT_CALL(*session_, MaybeSendRstStreamFrame( - stream_->id(), QUIC_HEADERS_TOO_LARGE, 0)); - } + EXPECT_CALL(*session_, MaybeSendRstStreamFrame(stream_->id(), + QUIC_HEADERS_TOO_LARGE, 0)); stream_->OnStreamHeaderList(false, 1 << 20, headers); EXPECT_THAT(stream_->stream_error(), IsStreamError(QUIC_HEADERS_TOO_LARGE)); @@ -541,15 +536,10 @@ QuicStreamFrame frame(stream_->id(), false, 0, headers); - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, - SendRstStream(stream_->id(), QUIC_HEADERS_TOO_LARGE, 0, _)); - } else { - EXPECT_CALL(*session_, MaybeSendStopSendingFrame(stream_->id(), - QUIC_HEADERS_TOO_LARGE)); - EXPECT_CALL(*session_, MaybeSendRstStreamFrame(stream_->id(), - QUIC_HEADERS_TOO_LARGE, 0)); - } + EXPECT_CALL(*session_, + MaybeSendStopSendingFrame(stream_->id(), QUIC_HEADERS_TOO_LARGE)); + EXPECT_CALL(*session_, MaybeSendRstStreamFrame(stream_->id(), + QUIC_HEADERS_TOO_LARGE, 0)); auto qpack_decoder_stream = QuicSpdySessionPeer::GetQpackDecoderSendStream(session_.get()); @@ -685,11 +675,7 @@ ConnectionCloseSource source) { session_->ReallyOnConnectionClosed(frame, source); })); - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, SendRstStream(_, _, _, _)).Times(2); - } else { - EXPECT_CALL(*session_, MaybeSendRstStreamFrame(_, _, _)).Times(2); - } + EXPECT_CALL(*session_, MaybeSendRstStreamFrame(_, _, _)).Times(2); stream_->OnStreamFrame(frame); } @@ -2116,11 +2102,7 @@ ConnectionCloseSource source) { session_->ReallyOnConnectionClosed(frame, source); })); - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, SendRstStream(_, _, _, _)).Times(2); - } else { - EXPECT_CALL(*session_, MaybeSendRstStreamFrame(_, _, _)).Times(2); - } + EXPECT_CALL(*session_, MaybeSendRstStreamFrame(_, _, _)).Times(2); stream_->OnStreamFrame(frame); } @@ -2158,13 +2140,8 @@ session_->ReallyOnConnectionClosed(frame, source); })); } - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, SendRstStream(stream_->id(), _, _, _)); - EXPECT_CALL(*session_, SendRstStream(stream2_->id(), _, _, _)); - } else { - EXPECT_CALL(*session_, MaybeSendRstStreamFrame(stream_->id(), _, _)); - EXPECT_CALL(*session_, MaybeSendRstStreamFrame(stream2_->id(), _, _)); - } + EXPECT_CALL(*session_, MaybeSendRstStreamFrame(stream_->id(), _, _)); + EXPECT_CALL(*session_, MaybeSendRstStreamFrame(stream2_->id(), _, _)); // Invalid headers: Required Insert Count is zero, but the header block // contains a dynamic table reference. @@ -2478,15 +2455,10 @@ /* offset = */ 1, _, _, _)); // Reset stream by this endpoint, for example, due to stream cancellation. - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, - SendRstStream(stream_->id(), QUIC_STREAM_CANCELLED, _, _)); - } else { - EXPECT_CALL(*session_, MaybeSendStopSendingFrame(stream_->id(), - QUIC_STREAM_CANCELLED)); - EXPECT_CALL(*session_, MaybeSendRstStreamFrame(stream_->id(), - QUIC_STREAM_CANCELLED, _)); - } + EXPECT_CALL(*session_, + MaybeSendStopSendingFrame(stream_->id(), QUIC_STREAM_CANCELLED)); + EXPECT_CALL(*session_, + MaybeSendRstStreamFrame(stream_->id(), QUIC_STREAM_CANCELLED, _)); stream_->Reset(QUIC_STREAM_CANCELLED); // Deliver dynamic table entry to decoder. @@ -2987,15 +2959,10 @@ EXPECT_CALL(*session_, WritevData(qpack_decoder_stream->id(), /* write_length = */ 1, /* offset = */ 1, _, _, _)); - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, - SendRstStream(stream_->id(), QUIC_STREAM_CANCELLED, _, _)); - } else { - EXPECT_CALL(*session_, MaybeSendStopSendingFrame(stream_->id(), - QUIC_STREAM_CANCELLED)); - EXPECT_CALL(*session_, MaybeSendRstStreamFrame(stream_->id(), - QUIC_STREAM_CANCELLED, _)); - } + EXPECT_CALL(*session_, + MaybeSendStopSendingFrame(stream_->id(), QUIC_STREAM_CANCELLED)); + EXPECT_CALL(*session_, + MaybeSendRstStreamFrame(stream_->id(), QUIC_STREAM_CANCELLED, _)); stream_->Reset(QUIC_STREAM_CANCELLED); }
diff --git a/quic/core/quic_flags_list.h b/quic/core/quic_flags_list.h index 4f75fc1..1c161e2 100644 --- a/quic/core/quic_flags_list.h +++ b/quic/core/quic_flags_list.h
@@ -55,7 +55,6 @@ QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_send_timestamps, false) QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_send_tls_crypto_error_code, false) QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_single_ack_in_packet2, false) -QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_split_up_send_rst_2, true) QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_start_peer_migration_earlier, false) QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_testonly_default_false, false) QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_testonly_default_true, true)
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc index 5112cde..8cd0a57 100644 --- a/quic/core/quic_session.cc +++ b/quic/core/quic_session.cc
@@ -847,32 +847,6 @@ return connection_->SendControlFrame(frame); } -void QuicSession::SendRstStream(QuicStreamId id, - QuicRstStreamErrorCode error, - QuicStreamOffset bytes_written, - bool send_rst_only) { - QUICHE_DCHECK(!split_up_send_rst()); - if (!connection()->connected()) { - return; - } - - QuicConnection::ScopedPacketFlusher flusher(connection()); - if (!VersionHasIetfQuicFrames(transport_version()) || - QuicUtils::GetStreamType(id, perspective(), IsIncomingStream(id), - version()) != READ_UNIDIRECTIONAL) { - control_frame_manager_.WriteOrBufferRstStream(id, error, bytes_written); - } - if (!send_rst_only) { - if (VersionHasIetfQuicFrames(transport_version()) && - QuicUtils::GetStreamType(id, perspective(), IsIncomingStream(id), - version()) != WRITE_UNIDIRECTIONAL) { - control_frame_manager_.WriteOrBufferStopSending(error, id); - } - } - - connection_->OnStreamReset(id, error); -} - void QuicSession::ResetStream(QuicStreamId id, QuicRstStreamErrorCode error) { QuicStream* stream = GetStream(id); if (stream != nullptr && stream->is_static()) { @@ -887,19 +861,14 @@ return; } - if (split_up_send_rst()) { - QuicConnection::ScopedPacketFlusher flusher(connection()); - MaybeSendStopSendingFrame(id, error); - MaybeSendRstStreamFrame(id, error, 0); - } else { - SendRstStream(id, error, 0, /*send_rst_only = */ false); - } + QuicConnection::ScopedPacketFlusher flusher(connection()); + MaybeSendStopSendingFrame(id, error); + MaybeSendRstStreamFrame(id, error, 0); } void QuicSession::MaybeSendRstStreamFrame(QuicStreamId id, QuicRstStreamErrorCode error, QuicStreamOffset bytes_written) { - QUICHE_DCHECK(split_up_send_rst()); if (!connection()->connected()) { return; } @@ -914,7 +883,6 @@ void QuicSession::MaybeSendStopSendingFrame(QuicStreamId id, QuicRstStreamErrorCode error) { - QUICHE_DCHECK(split_up_send_rst()); if (!connection()->connected()) { return; }
diff --git a/quic/core/quic_session.h b/quic/core/quic_session.h index b995c5d..d9c9b93 100644 --- a/quic/core/quic_session.h +++ b/quic/core/quic_session.h
@@ -240,15 +240,6 @@ bool WriteControlFrame(const QuicFrame& frame, TransmissionType type) override; - // 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_2 is - // deprecated. - virtual void SendRstStream(QuicStreamId id, - QuicRstStreamErrorCode error, - QuicStreamOffset bytes_written, - bool send_rst_only); - // Called to send RST_STREAM (and STOP_SENDING) and close stream. If stream // |id| does not exist, just send RST_STREAM (and STOP_SENDING). virtual void ResetStream(QuicStreamId id, QuicRstStreamErrorCode error); @@ -369,8 +360,6 @@ return connection_->connection_id(); } - bool split_up_send_rst() const { return split_up_send_rst_; } - // Returns the number of currently open streams, excluding static streams, and // never counting unfinished streams. size_t GetNumActiveStreams() const; @@ -948,9 +937,6 @@ // creation of new outgoing bidirectional streams. bool liveness_testing_in_progress_; - 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 0649428..14ce157 100644 --- a/quic/core/quic_stream.cc +++ b/quic/core/quic_stream.cc
@@ -507,16 +507,7 @@ } stream_error_ = code; - - if (session()->split_up_send_rst()) { - QUIC_RELOADABLE_FLAG_COUNT_N(quic_split_up_send_rst_2, 1, 3); - MaybeSendRstStream(code); - } else { - session()->SendRstStream(id(), code, stream_bytes_written(), - /*send_rst_only = */ true); - rst_sent_ = true; - CloseWriteSide(); - } + MaybeSendRstStream(code); return true; } @@ -602,24 +593,14 @@ 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, 2, 3); - QuicConnection::ScopedPacketFlusher flusher(session()->connection()); - MaybeSendStopSending(error); - MaybeSendRstStream(error); - } else { - session()->SendRstStream(id(), error, stream_bytes_written(), - /*send_rst_only = */ false); - rst_sent_ = true; - } + QuicConnection::ScopedPacketFlusher flusher(session()->connection()); + MaybeSendStopSending(error); + MaybeSendRstStream(error); + if (read_side_closed_ && write_side_closed_ && !IsWaitingForAcks()) { session()->MaybeCloseZombieStream(id_); return; } - if (!session()->split_up_send_rst()) { - CloseReadSide(); - CloseWriteSide(); - } } void QuicStream::OnUnrecoverableError(QuicErrorCode error, @@ -872,7 +853,6 @@ } void QuicStream::MaybeSendStopSending(QuicRstStreamErrorCode error) { - QUICHE_DCHECK(session()->split_up_send_rst()); if (stop_sending_sent_) { return; } @@ -894,7 +874,6 @@ } void QuicStream::MaybeSendRstStream(QuicRstStreamErrorCode error) { - QUICHE_DCHECK(session()->split_up_send_rst()); if (rst_sent_) { return; } @@ -935,25 +914,15 @@ QUICHE_DCHECK(read_side_closed_ && write_side_closed_); if (!fin_sent_ && !rst_sent_) { - if (!session()->split_up_send_rst()) { - // For flow control accounting, tell the peer how many bytes have been - // written on this stream before termination. Done here if needed, using a - // RST_STREAM frame. - QUIC_DLOG(INFO) << ENDPOINT << "Sending RST_STREAM in OnClose: " << id(); - session_->SendRstStream(id(), QUIC_RST_ACKNOWLEDGEMENT, - stream_bytes_written(), - /*send_rst_only = */ false); - session_->MaybeCloseZombieStream(id_); - rst_sent_ = true; - } else { - 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 " - "STOP_SENDING"; - MaybeSendRstStream(QUIC_RST_ACKNOWLEDGEMENT); - session_->MaybeCloseZombieStream(id_); - } + QUIC_BUG_IF(session()->connection()->connected() && + session()->version().UsesHttp3()) + << "The stream should've already sent RST in response to " + "STOP_SENDING"; + // For flow control accounting, tell the peer how many bytes have been + // written on this stream before termination. Done here if needed, using a + // RST_STREAM frame. + MaybeSendRstStream(QUIC_RST_ACKNOWLEDGEMENT); + session_->MaybeCloseZombieStream(id_); } if (!flow_controller_.has_value() ||
diff --git a/quic/core/quic_stream_test.cc b/quic/core/quic_stream_test.cc index 9cb2ce5..46c4b4a 100644 --- a/quic/core/quic_stream_test.cc +++ b/quic/core/quic_stream_test.cc
@@ -116,15 +116,10 @@ // session_ now owns stream_. session_->ActivateStream(QuicWrapUnique(stream_)); // Ignore resetting when session_ is terminated. - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, SendRstStream(kTestStreamId, _, _, _)) - .Times(AnyNumber()); - } else { - EXPECT_CALL(*session_, MaybeSendStopSendingFrame(kTestStreamId, _)) - .Times(AnyNumber()); - EXPECT_CALL(*session_, MaybeSendRstStreamFrame(kTestStreamId, _, _)) - .Times(AnyNumber()); - } + EXPECT_CALL(*session_, MaybeSendStopSendingFrame(kTestStreamId, _)) + .Times(AnyNumber()); + EXPECT_CALL(*session_, MaybeSendRstStreamFrame(kTestStreamId, _, _)) + .Times(AnyNumber()); write_blocked_list_ = QuicSessionPeer::GetWriteBlockedStreams(session_.get()); } @@ -471,11 +466,7 @@ EXPECT_FALSE(rst_sent()); // Now close the stream, and expect that we send a RST. - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, SendRstStream(kTestStreamId, _, _, _)); - } else { - EXPECT_CALL(*session_, MaybeSendRstStreamFrame(kTestStreamId, _, _)); - } + EXPECT_CALL(*session_, MaybeSendRstStreamFrame(kTestStreamId, _, _)); QuicRstStreamFrame rst_frame(kInvalidControlFrameId, stream_->id(), QUIC_STREAM_CANCELLED, 1234); stream_->OnStreamReset(rst_frame); @@ -528,12 +519,7 @@ EXPECT_FALSE(rst_sent()); // Reset the stream. - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, SendRstStream(kTestStreamId, _, _, _)).Times(1); - } else { - EXPECT_CALL(*session_, MaybeSendRstStreamFrame(kTestStreamId, _, _)) - .Times(1); - } + EXPECT_CALL(*session_, MaybeSendRstStreamFrame(kTestStreamId, _, _)).Times(1); stream_->Reset(QUIC_STREAM_CANCELLED); EXPECT_FALSE(fin_sent()); EXPECT_TRUE(rst_sent()); @@ -943,11 +929,7 @@ EXPECT_TRUE(session_->HasUnackedStreamData()); EXPECT_EQ(1u, QuicStreamPeer::SendBuffer(stream_).size()); // Cancel stream. - if (session_->split_up_send_rst()) { - stream_->MaybeSendStopSending(QUIC_STREAM_NO_ERROR); - } else { - stream_->Reset(QUIC_STREAM_NO_ERROR); - } + stream_->MaybeSendStopSending(QUIC_STREAM_NO_ERROR); // stream still waits for acks as the error code is QUIC_STREAM_NO_ERROR, and // data is going to be retransmitted. EXPECT_TRUE(stream_->IsWaitingForAcks()); @@ -957,21 +939,13 @@ EXPECT_CALL(*session_, WriteControlFrame(_, _)) .Times(AtLeast(1)) .WillRepeatedly(Invoke(&ClearControlFrameWithTransmissionType)); - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, - SendRstStream(stream_->id(), QUIC_STREAM_CANCELLED, 9, _)) - .WillOnce(InvokeWithoutArgs([this]() { - session_->ReallySendRstStream(stream_->id(), QUIC_STREAM_CANCELLED, - stream_->stream_bytes_written(), false); - })); - } else { - EXPECT_CALL(*session_, MaybeSendRstStreamFrame(_, _, _)) - .WillOnce(InvokeWithoutArgs([this]() { - session_->ReallyMaybeSendRstStreamFrame( - stream_->id(), QUIC_STREAM_CANCELLED, - stream_->stream_bytes_written()); - })); - } + + EXPECT_CALL(*session_, MaybeSendRstStreamFrame(_, _, _)) + .WillOnce(InvokeWithoutArgs([this]() { + session_->ReallyMaybeSendRstStreamFrame( + stream_->id(), QUIC_STREAM_CANCELLED, + stream_->stream_bytes_written()); + })); stream_->Reset(QUIC_STREAM_CANCELLED); EXPECT_EQ(1u, QuicStreamPeer::SendBuffer(stream_).size()); @@ -1003,13 +977,8 @@ QuicRstStreamFrame rst_frame(kInvalidControlFrameId, stream_->id(), QUIC_STREAM_CANCELLED, 9); - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, - SendRstStream(stream_->id(), QUIC_RST_ACKNOWLEDGEMENT, 9, _)); - } else { - EXPECT_CALL(*session_, MaybeSendRstStreamFrame( - stream_->id(), QUIC_RST_ACKNOWLEDGEMENT, 9)); - } + EXPECT_CALL(*session_, MaybeSendRstStreamFrame(stream_->id(), + QUIC_RST_ACKNOWLEDGEMENT, 9)); stream_->OnStreamReset(rst_frame); EXPECT_EQ(1u, QuicStreamPeer::SendBuffer(stream_).size()); // Stream stops waiting for acks as it does not finish sending and rst is @@ -1031,7 +1000,6 @@ EXPECT_TRUE(session_->HasUnackedStreamData()); // RST_STREAM received. - EXPECT_CALL(*session_, SendRstStream(_, _, _, _)).Times(0); QuicRstStreamFrame rst_frame(kInvalidControlFrameId, stream_->id(), QUIC_STREAM_CANCELLED, 1234); stream_->OnStreamReset(rst_frame); @@ -1052,13 +1020,8 @@ stream_->WriteOrBufferData(kData1, false, nullptr); EXPECT_TRUE(stream_->IsWaitingForAcks()); EXPECT_TRUE(session_->HasUnackedStreamData()); - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, - SendRstStream(stream_->id(), QUIC_RST_ACKNOWLEDGEMENT, 9, _)); - } else { - EXPECT_CALL(*session_, MaybeSendRstStreamFrame( - stream_->id(), QUIC_RST_ACKNOWLEDGEMENT, 9)); - } + EXPECT_CALL(*session_, MaybeSendRstStreamFrame(stream_->id(), + QUIC_RST_ACKNOWLEDGEMENT, 9)); QuicConnectionPeer::SetConnectionClose(connection_); stream_->OnConnectionClosed(QUIC_INTERNAL_ERROR, ConnectionCloseSource::FROM_SELF); @@ -1583,19 +1546,13 @@ connection_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); // Verify stream gets reset because TTL expires. - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, SendRstStream(_, QUIC_STREAM_TTL_EXPIRED, _, _)) - .Times(1); - } else { - if (session_->version().UsesHttp3()) { - EXPECT_CALL(*session_, - MaybeSendStopSendingFrame(_, QUIC_STREAM_TTL_EXPIRED)) - .Times(1); - } + if (session_->version().UsesHttp3()) { EXPECT_CALL(*session_, - MaybeSendRstStreamFrame(_, QUIC_STREAM_TTL_EXPIRED, _)) + MaybeSendStopSendingFrame(_, QUIC_STREAM_TTL_EXPIRED)) .Times(1); } + EXPECT_CALL(*session_, MaybeSendRstStreamFrame(_, QUIC_STREAM_TTL_EXPIRED, _)) + .Times(1); stream_->OnCanWrite(); } @@ -1613,19 +1570,13 @@ connection_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); // Verify stream gets reset because TTL expires. - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, SendRstStream(_, QUIC_STREAM_TTL_EXPIRED, _, _)) - .Times(1); - } else { - if (session_->version().UsesHttp3()) { - EXPECT_CALL(*session_, - MaybeSendStopSendingFrame(_, QUIC_STREAM_TTL_EXPIRED)) - .Times(1); - } + if (session_->version().UsesHttp3()) { EXPECT_CALL(*session_, - MaybeSendRstStreamFrame(_, QUIC_STREAM_TTL_EXPIRED, _)) + MaybeSendStopSendingFrame(_, QUIC_STREAM_TTL_EXPIRED)) .Times(1); } + EXPECT_CALL(*session_, MaybeSendRstStreamFrame(_, QUIC_STREAM_TTL_EXPIRED, _)) + .Times(1); stream_->RetransmitStreamData(0, 100, false, PTO_RETRANSMISSION); }
diff --git a/quic/qbone/qbone_stream_test.cc b/quic/qbone/qbone_stream_test.cc index 966a1b7..bcbc5a5 100644 --- a/quic/qbone/qbone_stream_test.cc +++ b/quic/qbone/qbone_stream_test.cc
@@ -59,10 +59,6 @@ // Called by QuicStream when they want to close stream. MOCK_METHOD(void, - SendRstStream, - (QuicStreamId, QuicRstStreamErrorCode, QuicStreamOffset, bool), - (override)); - MOCK_METHOD(void, MaybeSendRstStreamFrame, (QuicStreamId stream_id, QuicRstStreamErrorCode error, @@ -245,15 +241,10 @@ CreateReliableQuicStream(); std::string packet = "0123456789"; int iterations = (QboneConstants::kMaxQbonePacketBytes / packet.size()) + 2; - if (!session_->split_up_send_rst()) { - EXPECT_CALL(*session_, - SendRstStream(kStreamId, QUIC_BAD_APPLICATION_PAYLOAD, _, _)); - } else { - EXPECT_CALL(*session_, MaybeSendStopSendingFrame( - kStreamId, QUIC_BAD_APPLICATION_PAYLOAD)); - EXPECT_CALL(*session_, MaybeSendRstStreamFrame( - kStreamId, QUIC_BAD_APPLICATION_PAYLOAD, _)); - } + EXPECT_CALL(*session_, MaybeSendStopSendingFrame( + kStreamId, QUIC_BAD_APPLICATION_PAYLOAD)); + EXPECT_CALL(*session_, MaybeSendRstStreamFrame( + kStreamId, QUIC_BAD_APPLICATION_PAYLOAD, _)); for (int i = 0; i < iterations; ++i) { QuicStreamFrame frame(kStreamId, i == (iterations - 1), i * packet.size(), packet);
diff --git a/quic/test_tools/quic_test_utils.h b/quic/test_tools/quic_test_utils.h index 893b18f..7b4b18f 100644 --- a/quic/test_tools/quic_test_utils.h +++ b/quic/test_tools/quic_test_utils.h
@@ -879,14 +879,6 @@ WriteControlFrame, (const QuicFrame& frame, TransmissionType type), (override)); - - MOCK_METHOD(void, - SendRstStream, - (QuicStreamId stream_id, - QuicRstStreamErrorCode error, - QuicStreamOffset bytes_written, - bool send_rst_only), - (override)); MOCK_METHOD(void, MaybeSendRstStreamFrame, (QuicStreamId stream_id, @@ -921,13 +913,6 @@ TransmissionType type, absl::optional<EncryptionLevel> level); - void ReallySendRstStream(QuicStreamId id, - QuicRstStreamErrorCode error, - QuicStreamOffset bytes_written, - bool send_rst_only) { - QuicSession::SendRstStream(id, error, bytes_written, send_rst_only); - } - void ReallyMaybeSendRstStreamFrame(QuicStreamId id, QuicRstStreamErrorCode error, QuicStreamOffset bytes_written) { @@ -1033,13 +1018,6 @@ absl::optional<EncryptionLevel> level), (override)); MOCK_METHOD(void, - SendRstStream, - (QuicStreamId stream_id, - QuicRstStreamErrorCode error, - QuicStreamOffset bytes_written, - bool send_rst_only), - (override)); - MOCK_METHOD(void, MaybeSendRstStreamFrame, (QuicStreamId stream_id, QuicRstStreamErrorCode error,
diff --git a/quic/tools/quic_simple_server_stream_test.cc b/quic/tools/quic_simple_server_stream_test.cc index cee1753..5806ad7 100644 --- a/quic/tools/quic_simple_server_stream_test.cc +++ b/quic/tools/quic_simple_server_stream_test.cc
@@ -164,13 +164,6 @@ const spdy::SpdyStreamPrecedence& precedence), (override)); MOCK_METHOD(void, - SendRstStream, - (QuicStreamId stream_id, - QuicRstStreamErrorCode error, - QuicStreamOffset bytes_written, - bool send_rst_only), - (override)); - MOCK_METHOD(void, MaybeSendRstStreamFrame, (QuicStreamId stream_id, QuicRstStreamErrorCode error, @@ -366,17 +359,12 @@ QuicStreamPeer::SetFinSent(stream_); stream_->CloseWriteSide(); - if (!session_.split_up_send_rst()) { - EXPECT_CALL(session_, SendRstStream(_, QUIC_STREAM_NO_ERROR, _, _)) + if (session_.version().UsesHttp3()) { + EXPECT_CALL(session_, MaybeSendStopSendingFrame(_, QUIC_STREAM_NO_ERROR)) .Times(1); } else { - if (session_.version().UsesHttp3()) { - EXPECT_CALL(session_, MaybeSendStopSendingFrame(_, QUIC_STREAM_NO_ERROR)) - .Times(1); - } else { - EXPECT_CALL(session_, MaybeSendRstStreamFrame(_, QUIC_STREAM_NO_ERROR, _)) - .Times(1); - } + EXPECT_CALL(session_, MaybeSendRstStreamFrame(_, QUIC_STREAM_NO_ERROR, _)) + .Times(1); } stream_->StopReading(); } @@ -393,8 +381,6 @@ } EXPECT_CALL(session_, WritevData(_, kErrorLength, _, FIN, _, _)); - EXPECT_CALL(session_, SendRstStream(_, QUIC_STREAM_NO_ERROR, _, _)).Times(0); - stream_->OnStreamHeaderList(false, kFakeFrameLen, header_list_); std::unique_ptr<char[]> buffer; QuicByteCount header_length = @@ -505,16 +491,12 @@ std::move(response_headers_), body); InSequence s; - if (!session_.split_up_send_rst()) { - EXPECT_CALL(session_, SendRstStream(_, QUIC_STREAM_CANCELLED, 0, _)); - } else { - if (session_.version().UsesHttp3()) { - EXPECT_CALL(session_, MaybeSendStopSendingFrame(promised_stream->id(), - QUIC_STREAM_CANCELLED)); - } - EXPECT_CALL(session_, MaybeSendRstStreamFrame(promised_stream->id(), - QUIC_STREAM_CANCELLED, 0)); + if (session_.version().UsesHttp3()) { + EXPECT_CALL(session_, MaybeSendStopSendingFrame(promised_stream->id(), + QUIC_STREAM_CANCELLED)); } + EXPECT_CALL(session_, MaybeSendRstStreamFrame(promised_stream->id(), + QUIC_STREAM_CANCELLED, 0)); promised_stream->DoSendResponse(); } @@ -650,8 +632,6 @@ } TEST_P(QuicSimpleServerStreamTest, TestSendErrorResponse) { - EXPECT_CALL(session_, SendRstStream(_, QUIC_STREAM_NO_ERROR, _, _)).Times(0); - QuicStreamPeer::SetFinReceived(stream_); InSequence s; @@ -668,8 +648,6 @@ } TEST_P(QuicSimpleServerStreamTest, InvalidMultipleContentLength) { - EXPECT_CALL(session_, SendRstStream(_, QUIC_STREAM_NO_ERROR, _, _)).Times(0); - spdy::Http2HeaderBlock request_headers; // \000 is a way to write the null byte when followed by a literal digit. header_list_.OnHeader("content-length", absl::string_view("11\00012", 5)); @@ -686,8 +664,6 @@ } TEST_P(QuicSimpleServerStreamTest, InvalidLeadingNullContentLength) { - EXPECT_CALL(session_, SendRstStream(_, QUIC_STREAM_NO_ERROR, _, _)).Times(0); - spdy::Http2HeaderBlock request_headers; // \000 is a way to write the null byte when followed by a literal digit. header_list_.OnHeader("content-length", absl::string_view("\00012", 3)); @@ -720,7 +696,6 @@ DoNotSendQuicRstStreamNoErrorWithRstReceived) { EXPECT_FALSE(stream_->reading_stopped()); - EXPECT_CALL(session_, SendRstStream(_, QUIC_STREAM_NO_ERROR, _, _)).Times(0); if (VersionUsesHttp3(connection_->transport_version())) { // Unidirectional stream type and then a Stream Cancellation instruction is // sent on the QPACK decoder stream. Ignore these writes without any @@ -731,22 +706,12 @@ .Times(AnyNumber()); } - if (!session_.split_up_send_rst()) { - EXPECT_CALL(session_, SendRstStream(_, - session_.version().UsesHttp3() - ? QUIC_STREAM_CANCELLED - : QUIC_RST_ACKNOWLEDGEMENT, - _, _)) - .Times(1); - } else { - EXPECT_CALL(session_, - MaybeSendRstStreamFrame(_, - session_.version().UsesHttp3() - ? QUIC_STREAM_CANCELLED - : QUIC_RST_ACKNOWLEDGEMENT, - _)) - .Times(1); - } + EXPECT_CALL(session_, MaybeSendRstStreamFrame(_, + session_.version().UsesHttp3() + ? QUIC_STREAM_CANCELLED + : QUIC_RST_ACKNOWLEDGEMENT, + _)) + .Times(1); QuicRstStreamFrame rst_frame(kInvalidControlFrameId, stream_->id(), QUIC_STREAM_CANCELLED, 1234); stream_->OnStreamReset(rst_frame);