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

Side by Side Diff: net/quic/p2p/quic_p2p_stream.cc

Issue 1273233002: Implement QuicChannel and QuicChannelFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « net/quic/p2p/quic_p2p_session_test.cc ('k') | remoting/base/compound_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/p2p/quic_p2p_stream.h" 5 #include "net/quic/p2p/quic_p2p_stream.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 #include "net/quic/quic_session.h" 9 #include "net/quic/quic_session.h"
10 #include "net/quic/quic_write_blocked_list.h" 10 #include "net/quic/quic_write_blocked_list.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 QuicP2PStream::QuicP2PStream(QuicStreamId id, QuicSession* session) 14 QuicP2PStream::QuicP2PStream(QuicStreamId id, QuicSession* session)
15 : ReliableQuicStream(id, session) {} 15 : ReliableQuicStream(id, session) {}
16 16
17 QuicP2PStream::~QuicP2PStream() {} 17 QuicP2PStream::~QuicP2PStream() {}
18 18
19 void QuicP2PStream::OnDataAvailable() { 19 void QuicP2PStream::OnDataAvailable() {
20 DCHECK(delegate_); 20 DCHECK(delegate_);
21 21
22 char buffer[1024];
23 struct iovec iov; 22 struct iovec iov;
24 while (true) { 23 while (true) {
25 iov.iov_base = buffer;
26 iov.iov_len = arraysize(buffer);
27 if (sequencer()->GetReadableRegions(&iov, 1) != 1) { 24 if (sequencer()->GetReadableRegions(&iov, 1) != 1) {
28 // No more data to read. 25 // No more data to read.
29 break; 26 break;
30 } 27 }
31 delegate_->OnDataReceived(reinterpret_cast<const char*>(iov.iov_base), 28 delegate_->OnDataReceived(reinterpret_cast<const char*>(iov.iov_base),
32 iov.iov_len); 29 iov.iov_len);
33 sequencer()->MarkConsumed(iov.iov_len); 30 sequencer()->MarkConsumed(iov.iov_len);
34 } 31 }
35 } 32 }
36 33
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 last_write_size_ = data.size(); 71 last_write_size_ = data.size();
75 return ERR_IO_PENDING; 72 return ERR_IO_PENDING;
76 } 73 }
77 74
78 void QuicP2PStream::SetDelegate(QuicP2PStream::Delegate* delegate) { 75 void QuicP2PStream::SetDelegate(QuicP2PStream::Delegate* delegate) {
79 DCHECK(!(delegate_ && delegate)); 76 DCHECK(!(delegate_ && delegate));
80 delegate_ = delegate; 77 delegate_ = delegate;
81 } 78 }
82 79
83 } // namespace net 80 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/p2p/quic_p2p_session_test.cc ('k') | remoting/base/compound_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698