OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2011 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 "net/base/net_errors.h" | |
12 | |
13 #include "webrtc/base/checks.h" | |
14 #include "webrtc/p2p/base/reliablequicstream.h" | |
15 | |
16 namespace cricket { | |
17 | |
18 ReliableQuicStream::ReliableQuicStream(net::QuicStreamId id, | |
19 net::QuicSession* session) | |
20 : net::ReliableQuicStream(id, session) { | |
21 RTC_DCHECK_NE(net::kCryptoStreamId, id); | |
22 } | |
23 | |
24 ReliableQuicStream::~ReliableQuicStream() {} | |
25 | |
26 void ReliableQuicStream::OnDataAvailable() { | |
27 struct iovec iov; | |
28 while (sequencer()->GetReadableRegions(&iov, 1) == 1) { | |
29 SignalDataReceived(id(), reinterpret_cast<const char*>(iov.iov_base), | |
30 iov.iov_len); | |
31 sequencer()->MarkConsumed(iov.iov_len); | |
32 } | |
33 } | |
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.
| |
34 | |
35 void ReliableQuicStream::OnClose() { | |
36 net::ReliableQuicStream::OnClose(); | |
37 | |
38 SignalStreamClosed(id(), connection_error()); | |
39 } | |
40 | |
41 int ReliableQuicStream::Write(base::StringPiece data) { | |
42 // Writes the data, or buffers it. | |
43 WriteOrBufferData(data, false, nullptr); | |
44 if (!HasBufferedData()) { | |
45 return data.size(); | |
46 } | |
47 | |
48 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
| |
49 } | |
50 | |
51 } // namespace cricket | |
OLD | NEW |