OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #include <string> | |
12 | |
13 #include "webrtc/p2p/quic/reliablequicstream.h" | |
14 | |
15 #include "webrtc/base/checks.h" | |
16 | |
17 namespace cricket { | |
18 | |
19 ReliableQuicStream::ReliableQuicStream(net::QuicStreamId id, | |
20 net::QuicSession* session) | |
21 : net::ReliableQuicStream(id, session) { | |
22 RTC_DCHECK_NE(net::kCryptoStreamId, id); | |
23 } | |
24 | |
25 ReliableQuicStream::~ReliableQuicStream() {} | |
26 | |
27 void ReliableQuicStream::OnDataAvailable() { | |
28 struct iovec iov; | |
29 while (sequencer()->GetReadableRegions(&iov, 1) == 1) { | |
30 SignalDataReceived(id(), reinterpret_cast<const char*>(iov.iov_base), | |
31 iov.iov_len); | |
32 sequencer()->MarkConsumed(iov.iov_len); | |
33 } | |
34 } | |
35 | |
36 void ReliableQuicStream::OnClose() { | |
37 net::ReliableQuicStream::OnClose(); | |
38 | |
Taylor Brandstetter
2016/02/06 00:22:45
nit: whitespace
mikescarlett
2016/02/06 02:14:09
Done.
| |
39 SignalClosed(id(), connection_error()); | |
40 } | |
41 | |
42 rtc::StreamResult ReliableQuicStream::Write(const char* data, size_t len) { | |
43 // Writes the data, or buffers it. | |
44 WriteOrBufferData(std::string(data, len), false, nullptr); | |
45 if (HasBufferedData()) { | |
46 return rtc::StreamResult(rtc::SR_BLOCK); | |
47 } | |
48 | |
49 return rtc::StreamResult(rtc::SR_SUCCESS); | |
50 } | |
51 | |
52 } // namespace cricket | |
OLD | NEW |