Handle closing pending streams.

Make QuicSession handle if a pending stream is closed before it gets converted
into the appropriate incoming stream subclass.

gfe-relnote: n/a, no functional change outside QUIC v99-only code.  Protected by existing disabled gfe2_reloadable_flag_quic_enable_version_99.
PiperOrigin-RevId: 262183753
Change-Id: I4147320860b867df0d80ba8fd55106bf779b15b3
diff --git a/quic/core/quic_stream.cc b/quic/core/quic_stream.cc
index e8d6a01..4d460d3 100644
--- a/quic/core/quic_stream.cc
+++ b/quic/core/quic_stream.cc
@@ -58,13 +58,12 @@
       sequencer_(this) {}
 
 void PendingStream::OnDataAvailable() {
-  // It will be called when pending stream receives its first byte. But this
-  // call should simply be ignored so that data remains in sequencer.
+  // Data should be kept in the sequencer so that
+  // QuicSession::ProcessPendingStream() can read it.
 }
 
 void PendingStream::OnFinRead() {
-  QUIC_BUG << "OnFinRead should not be called.";
-  CloseConnectionWithDetails(QUIC_INTERNAL_ERROR, "Unexpected fin read");
+  DCHECK(sequencer_.IsClosed());
 }
 
 void PendingStream::AddBytesConsumed(QuicByteCount bytes) {
@@ -74,6 +73,7 @@
 }
 
 void PendingStream::Reset(QuicRstStreamErrorCode error) {
+  // TODO: RESET_STREAM must not be sent for READ_UNIDIRECTIONAL stream.
   session_->SendRstStream(id_, error, 0);
 }