gfe-relnote: Default-initialize QUIC BBRv2 loss event threshold for exiting STARTUP from a flag. Protected by --gfe2_reloadable_flag_quic_default_to_bbr_v2.
PiperOrigin-RevId: 264298542
Change-Id: I304ab19e4820dec51d3f8ef53762a393f6b175fd
diff --git a/quic/qbone/qbone_stream.cc b/quic/qbone/qbone_stream.cc
new file mode 100644
index 0000000..b7ac007
--- /dev/null
+++ b/quic/qbone/qbone_stream.cc
@@ -0,0 +1,61 @@
+// Copyright (c) 2019 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/third_party/quiche/src/quic/qbone/qbone_stream.h"
+
+#include "net/third_party/quiche/src/quic/core/quic_data_reader.h"
+#include "net/third_party/quiche/src/quic/core/quic_data_writer.h"
+#include "net/third_party/quiche/src/quic/core/quic_types.h"
+#include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
+#include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
+#include "net/third_party/quiche/src/quic/qbone/qbone_constants.h"
+#include "net/third_party/quiche/src/quic/qbone/qbone_session_base.h"
+
+namespace quic {
+
+QboneWriteOnlyStream::QboneWriteOnlyStream(QuicStreamId id,
+ QuicSession* session)
+ : QuicStream(id, session, /*is_static=*/false, WRITE_UNIDIRECTIONAL) {
+ // QBONE uses a LIFO queue to try to always make progress. An individual
+ // packet may persist for upto to 10 seconds in memory.
+ MaybeSetTtl(QuicTime::Delta::FromSeconds(10));
+}
+
+void QboneWriteOnlyStream::WritePacketToQuicStream(QuicStringPiece packet) {
+ // Streams are one way and ephemeral. This function should only be
+ // called once.
+ WriteOrBufferData(packet, /* fin= */ true, nullptr);
+}
+
+QboneReadOnlyStream::QboneReadOnlyStream(QuicStreamId id,
+ QboneSessionBase* session)
+ : QuicStream(id,
+ session,
+ /*is_static=*/false,
+ READ_UNIDIRECTIONAL),
+ session_(session) {
+ // QBONE uses a LIFO queue to try to always make progress. An individual
+ // packet may persist for upto to 10 seconds in memory.
+ MaybeSetTtl(QuicTime::Delta::FromSeconds(10));
+}
+
+QboneReadOnlyStream::~QboneReadOnlyStream() {}
+
+void QboneReadOnlyStream::OnDataAvailable() {
+ // Read in data and buffer it, attempt to frame to see if there's a packet.
+ sequencer()->Read(&buffer_);
+ if (sequencer()->IsClosed()) {
+ session_->ProcessPacketFromPeer(buffer_);
+ OnFinRead();
+ return;
+ }
+ if (buffer_.size() > QboneConstants::kMaxQbonePacketBytes) {
+ if (!rst_sent()) {
+ Reset(QUIC_BAD_APPLICATION_PAYLOAD);
+ }
+ StopReading();
+ }
+}
+
+} // namespace quic