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

Side by Side Diff: webrtc/p2p/quic/reliablequicstream.cc

Issue 1844803002: Modify PeerConnection for end-to-end QuicDataChannel usage (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/p2p/quic/reliablequicstream.h" 11 #include "webrtc/p2p/quic/reliablequicstream.h"
12 12
13 #include <string> 13 #include <string>
14 14
15 #include "net/quic/quic_session.h"
15 #include "webrtc/base/checks.h" 16 #include "webrtc/base/checks.h"
16 17
17 namespace cricket { 18 namespace cricket {
18 19
19 ReliableQuicStream::ReliableQuicStream(net::QuicStreamId id, 20 ReliableQuicStream::ReliableQuicStream(net::QuicStreamId id,
20 net::QuicSession* session) 21 net::QuicSession* session)
21 : net::ReliableQuicStream(id, session) { 22 : net::ReliableQuicStream(id, session) {
22 RTC_DCHECK_NE(net::kCryptoStreamId, id); 23 RTC_DCHECK_NE(net::kCryptoStreamId, id);
23 } 24 }
24 25
25 ReliableQuicStream::~ReliableQuicStream() {} 26 ReliableQuicStream::~ReliableQuicStream() {}
26 27
27 void ReliableQuicStream::OnDataAvailable() { 28 void ReliableQuicStream::OnDataAvailable() {
28 struct iovec iov; 29 struct iovec iov;
29 while (sequencer()->GetReadableRegions(&iov, 1) == 1) { 30 while (sequencer()->GetReadableRegions(&iov, 1) == 1) {
30 SignalDataReceived(id(), reinterpret_cast<const char*>(iov.iov_base), 31 SignalDataReceived(id(), reinterpret_cast<const char*>(iov.iov_base),
31 iov.iov_len); 32 iov.iov_len);
32 sequencer()->MarkConsumed(iov.iov_len); 33 sequencer()->MarkConsumed(iov.iov_len);
33 } 34 }
34 } 35 }
35 36
36 void ReliableQuicStream::OnClose() { 37 void ReliableQuicStream::OnClose() {
37 net::ReliableQuicStream::OnClose(); 38 net::ReliableQuicStream::OnClose();
38 SignalClosed(id(), connection_error()); 39 SignalClosed(id(), connection_error());
39 } 40 }
40 41
41 rtc::StreamResult ReliableQuicStream::Write(const char* data, size_t len) { 42 rtc::StreamResult ReliableQuicStream::Write(const char* data,
43 size_t len,
44 bool fin) {
42 // Writes the data, or buffers it. 45 // Writes the data, or buffers it.
43 WriteOrBufferData(std::string(data, len), false, nullptr); 46 WriteOrBufferData(std::string(data, len), fin, nullptr);
44 if (HasBufferedData()) { 47 if (HasBufferedData()) {
45 return rtc::StreamResult(rtc::SR_BLOCK); 48 return rtc::StreamResult(rtc::SR_BLOCK);
46 } 49 }
47 50
48 return rtc::StreamResult(rtc::SR_SUCCESS); 51 return rtc::StreamResult(rtc::SR_SUCCESS);
49 } 52 }
50 53
54 void ReliableQuicStream::Close() {
55 net::ReliableQuicStream::session()->CloseStream(id());
56 }
57
51 } // namespace cricket 58 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698