Close any existing stream when processing an ephemeral packet.

I believe we can leak QuicStreams when the following happens:
1) The QuicPacketCreator chooses to pack part of the stream's frame to
   the end of an outgoing packet.
   (http://google3/third_party/quic/core/quic_packet_creator.cc?l=311&rcl=301250535)

2) The packet makes it to the far side of the connection and the
   QuicStream is created for the partial frame.

3) The ACK for this packet gets lost enough for the writer to retransmit
   but with the entire frame in the packet.

In this situation, we'll leave the initially created QuicStream around
forever.

gfe-relnote: n/a (QBONE-only change)
PiperOrigin-RevId: 304491014
Change-Id: Ia324ec36c5a5675becd618ceae162095237b1d1f
diff --git a/quic/qbone/qbone_session_base.cc b/quic/qbone/qbone_session_base.cc
index 68f659c..53d4e58 100644
--- a/quic/qbone/qbone_session_base.cc
+++ b/quic/qbone/qbone_session_base.cc
@@ -18,6 +18,12 @@
 #include "net/third_party/quiche/src/quic/qbone/qbone_constants.h"
 #include "net/third_party/quiche/src/common/platform/api/quiche_string_piece.h"
 
+ABSL_FLAG(
+    bool,
+    qbone_close_ephemeral_frames,
+    true,
+    "If true, we'll call CloseStream even when we receive ephemeral frames.");
+
 namespace quic {
 
 #define ENDPOINT \
@@ -84,6 +90,11 @@
     ProcessPacketFromPeer(
         quiche::QuicheStringPiece(frame.data_buffer, frame.data_length));
     flow_controller()->AddBytesConsumed(frame.data_length);
+    // TODO(b/147817422): Add a counter for how many streams were actually
+    // closed here.
+    if (GetQuicFlag(FLAGS_qbone_close_ephemeral_frames)) {
+      CloseStream(frame.stream_id);
+    }
     return;
   }
   QuicSession::OnStreamFrame(frame);