Remove redundant stream finding code when STOP_SENDING frame is received.
QuicSession::OnStopSending() already finds the stream and does staticness checks. We can simplify QuicSession::SendRstStreamInner() by moving the stream book keeping to OnStopSending().
gfe-relnote: protected by disabled v99 flag.
PiperOrigin-RevId: 278745064
Change-Id: I3734cff264fdadd58d3dfe50b418fd4c76bd19ce
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index c16b723..2761e61 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -272,6 +272,8 @@
static_cast<quic::QuicRstStreamErrorCode>(frame.application_error_code),
stream->stream_bytes_written(),
/*close_write_side_only=*/true);
+ stream->set_rst_sent(true);
+ stream->CloseWriteSide();
}
void QuicSession::PendingStreamOnRstStream(const QuicRstStreamFrame& frame) {
@@ -715,26 +717,6 @@
if (!close_write_side_only) {
CloseStreamInner(id, true);
- return;
- }
- DCHECK(VersionHasIetfQuicFrames(transport_version()));
-
- StreamMap::iterator it = stream_map_.find(id);
- if (it != stream_map_.end()) {
- if (it->second->is_static()) {
- QUIC_DVLOG(1) << ENDPOINT
- << "Try to send rst for a static stream, id: " << id
- << " Closing connection";
- connection()->CloseConnection(
- QUIC_INVALID_STREAM_ID, "Sending rst for a static stream",
- ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
- return;
- }
- QuicStream* stream = it->second.get();
- if (stream) {
- stream->set_rst_sent(true);
- stream->CloseWriteSide();
- }
}
}