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

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

Issue 1648763002: Create QuicSession (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Sync webrtc/build/common.gypi to fix patch issue Created 4 years, 10 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
« no previous file with comments | « webrtc/p2p/quic/reliablequicstream.h ('k') | webrtc/p2p/quic/reliablequicstream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/quic/reliablequicstream.cc
diff --git a/webrtc/p2p/quic/reliablequicstream.cc b/webrtc/p2p/quic/reliablequicstream.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ca2e3f0d3be3a4475dd6ab5b546eef6c82d281c1
--- /dev/null
+++ b/webrtc/p2p/quic/reliablequicstream.cc
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2016 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 "webrtc/p2p/quic/reliablequicstream.h"
+
+#include <string>
+
+#include "webrtc/base/checks.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);
+ }
+}
+
+void ReliableQuicStream::OnClose() {
+ net::ReliableQuicStream::OnClose();
+ SignalClosed(id(), connection_error());
+}
+
+rtc::StreamResult ReliableQuicStream::Write(const char* data, size_t len) {
+ // Writes the data, or buffers it.
+ WriteOrBufferData(std::string(data, len), false, nullptr);
+ if (HasBufferedData()) {
+ return rtc::StreamResult(rtc::SR_BLOCK);
+ }
+
+ return rtc::StreamResult(rtc::SR_SUCCESS);
+}
+
+} // namespace cricket
« no previous file with comments | « webrtc/p2p/quic/reliablequicstream.h ('k') | webrtc/p2p/quic/reliablequicstream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698