Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Unified Diff: webrtc/p2p/base/reliablequicstream.cc

Issue 1648763002: Create QuicSession (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/p2p/base/reliablequicstream.cc
diff --git a/webrtc/p2p/base/reliablequicstream.cc b/webrtc/p2p/base/reliablequicstream.cc
new file mode 100644
index 0000000000000000000000000000000000000000..58416b882ab2b47f2c560e66449e693645c3fcd7
--- /dev/null
+++ b/webrtc/p2p/base/reliablequicstream.cc
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2011 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include "net/base/net_errors.h"
+
+#include "webrtc/base/checks.h"
+#include "webrtc/p2p/base/reliablequicstream.h"
+
+namespace cricket {
+
+ReliableQuicStream::ReliableQuicStream(net::QuicStreamId id,
+ net::QuicSession* session)
+ : net::ReliableQuicStream(id, session) {
+ RTC_DCHECK_NE(net::kCryptoStreamId, id);
+}
+
+ReliableQuicStream::~ReliableQuicStream() {}
+
+void ReliableQuicStream::OnDataAvailable() {
+ struct iovec iov;
+ while (sequencer()->GetReadableRegions(&iov, 1) == 1) {
+ SignalDataReceived(id(), reinterpret_cast<const char*>(iov.iov_base),
+ iov.iov_len);
+ sequencer()->MarkConsumed(iov.iov_len);
+ }
+}
pthatcher1 2016/01/30 03:01:52 Are you going to write a simple unit test for this
mikescarlett 2016/02/03 17:41:01 Yes I will.
+
+void ReliableQuicStream::OnClose() {
+ net::ReliableQuicStream::OnClose();
+
+ SignalStreamClosed(id(), connection_error());
+}
+
+int ReliableQuicStream::Write(base::StringPiece data) {
+ // Writes the data, or buffers it.
+ WriteOrBufferData(data, false, nullptr);
+ if (!HasBufferedData()) {
+ return data.size();
+ }
+
+ return net::ERR_IO_PENDING;
pthatcher1 2016/01/30 03:01:52 Can you convert this to an rtc::StreamResult?
pthatcher1 2016/01/30 03:01:52 If prefer it in the reverse: if (HasBufferedData(
mikescarlett 2016/02/03 17:41:01 Reversed if statement.
mikescarlett 2016/02/03 17:41:01 Converted to rtc::StreamResult. Also changed the m
+}
+
+} // namespace cricket
« webrtc/p2p/base/reliablequicstream.h ('K') | « webrtc/p2p/base/reliablequicstream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698