Fix Reset logic in PendingStream. Pending streams are now only used as read-unidirectional streams. As pointed in https://tools.ietf.org/html/draft-ietf-quic-transport-23#section-19.4, the stream shouldn't send any RESET_STREAM frame. gfe-relnote: protected by disabled v99 flag. PiperOrigin-RevId: 276570554 Change-Id: Ie0bd05af05af9d088d491357561fea3015b5503b
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc index dadccf8..f95b994 100644 --- a/quic/core/http/quic_spdy_session_test.cc +++ b/quic/core/http/quic_spdy_session_test.cc
@@ -2404,12 +2404,6 @@ QUIC_STREAM_CANCELLED, /* bytes_written = */ payload.size()); - // This will trigger the sending of two control frames: one RESET_STREAM with - // QUIC_RST_ACKNOWLEDGEMENT, and one STOP_SENDING. - EXPECT_CALL(*connection_, SendControlFrame(_)) - .Times(2) - .WillRepeatedly(Invoke(&ClearControlFrame)); - EXPECT_CALL(*connection_, OnStreamReset(stream_id, QUIC_RST_ACKNOWLEDGEMENT)); session_.OnRstStream(rst_frame); // The stream is closed. @@ -2477,12 +2471,6 @@ QUIC_STREAM_CANCELLED, /* bytes_written = */ payload.size()); - // This will trigger the sending of two control frames: one RESET_STREAM with - // QUIC_RST_ACKNOWLEDGEMENT, and one STOP_SENDING. - EXPECT_CALL(*connection_, SendControlFrame(_)) - .Times(2) - .WillRepeatedly(Invoke(&ClearControlFrame)); - EXPECT_CALL(*connection_, OnStreamReset(stream_id, QUIC_RST_ACKNOWLEDGEMENT)); session_.OnRstStream(rst_frame); // The stream is closed.
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc index 09e305b..b9cef8d 100644 --- a/quic/core/quic_session.cc +++ b/quic/core/quic_session.cc
@@ -305,7 +305,10 @@ } pending->OnRstStreamFrame(frame); - SendRstStream(stream_id, QUIC_RST_ACKNOWLEDGEMENT, 0); + // Pending stream is currently read only. We can safely close the stream. + DCHECK_EQ(READ_UNIDIRECTIONAL, + QuicUtils::GetStreamType(pending->id(), perspective(), + /*peer_initiated = */ true)); ClosePendingStream(stream_id); }
diff --git a/quic/core/quic_session_test.cc b/quic/core/quic_session_test.cc index 845277b..f99c4a5 100644 --- a/quic/core/quic_session_test.cc +++ b/quic/core/quic_session_test.cc
@@ -1884,9 +1884,6 @@ EXPECT_EQ(0, session_.num_incoming_streams_created()); EXPECT_EQ(0u, session_.GetNumOpenIncomingStreams()); - EXPECT_CALL(*connection_, SendControlFrame(_)).Times(1); - EXPECT_CALL(*connection_, OnStreamReset(stream_id, QUIC_RST_ACKNOWLEDGEMENT)) - .Times(1); QuicRstStreamFrame rst1(kInvalidControlFrameId, stream_id, QUIC_ERROR_PROCESSING_STREAM, 12); session_.OnRstStream(rst1);
diff --git a/quic/core/quic_stream.cc b/quic/core/quic_stream.cc index aced2b9..360ac30 100644 --- a/quic/core/quic_stream.cc +++ b/quic/core/quic_stream.cc
@@ -136,9 +136,13 @@ connection_flow_controller_->AddBytesConsumed(bytes); } -void PendingStream::Reset(QuicRstStreamErrorCode error) { - // TODO: RESET_STREAM must not be sent for READ_UNIDIRECTIONAL stream. - session_->SendRstStream(id_, error, 0); +void PendingStream::Reset(QuicRstStreamErrorCode /*error*/) { + // Currently PendingStream is only read-unidirectional. It shouldn't send + // Reset. + DCHECK_EQ(READ_UNIDIRECTIONAL, + QuicUtils::GetStreamType(id_, session_->perspective(), + /*peer_initiated = */ true)); + QUIC_NOTREACHED(); } void PendingStream::CloseConnectionWithDetails(QuicErrorCode error,