Make QuicSession::ResetStream() smarter.
If the stream reseted doesn't exist, we always send out 0 as the bytes written. And if it doesn, we always send what the stream has written. So we don't need the explicit parameter for bytes_written.
No behavior change. not protected.
PiperOrigin-RevId: 319211675
Change-Id: I6c96d94e2d0ec1eca0c86a4740a7384aa15c8529
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index 9f4de44..97490d6 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -763,9 +763,7 @@
}
}
-void QuicSession::ResetStream(QuicStreamId id,
- QuicRstStreamErrorCode error,
- QuicStreamOffset bytes_written) {
+void QuicSession::ResetStream(QuicStreamId id, QuicRstStreamErrorCode error) {
QuicStream* stream = GetStream(id);
if (stream != nullptr && stream->is_static()) {
connection()->CloseConnection(
@@ -779,7 +777,7 @@
return;
}
- SendRstStream(id, error, bytes_written);
+ SendRstStream(id, error, 0);
}
void QuicSession::MaybeSendRstStreamFrame(QuicStreamId id,
@@ -1795,7 +1793,7 @@
if (!VersionHasIetfQuicFrames(transport_version()) &&
!stream_id_manager_.CanOpenIncomingStream()) {
// Refuse to open the stream.
- ResetStream(stream_id, QUIC_REFUSED_STREAM, 0);
+ ResetStream(stream_id, QUIC_REFUSED_STREAM);
return nullptr;
}