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

Side by Side Diff: net/quic/reliable_quic_stream.cc

Issue 180723003: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unintialized memory error Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_utils.cc ('k') | net/quic/reliable_quic_stream_test.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/reliable_quic_stream.h" 5 #include "net/quic/reliable_quic_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/quic/quic_session.h" 8 #include "net/quic/quic_session.h"
9 #include "net/quic/quic_spdy_decompressor.h" 9 #include "net/quic/quic_spdy_decompressor.h"
10 #include "net/quic/quic_write_blocked_list.h" 10 #include "net/quic/quic_write_blocked_list.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 if (write_side_closed_) { 175 if (write_side_closed_) {
176 DLOG(ERROR) << ENDPOINT << "Attempt to write when the write side is closed"; 176 DLOG(ERROR) << ENDPOINT << "Attempt to write when the write side is closed";
177 return QuicConsumedData(0, false); 177 return QuicConsumedData(0, false);
178 } 178 }
179 179
180 size_t write_length = 0u; 180 size_t write_length = 0u;
181 for (int i = 0; i < iov_count; ++i) { 181 for (int i = 0; i < iov_count; ++i) {
182 write_length += iov[i].iov_len; 182 write_length += iov[i].iov_len;
183 // TODO(rjshade): Maybe block write based on available flow control window. 183 // TODO(rjshade): Maybe block write based on available flow control window.
184 } 184 }
185
186 // Fill an IOVector with bytes from the iovec.
187 IOVector data;
188 data.AppendIovecAtMostBytes(iov, iov_count, write_length);
189
185 QuicConsumedData consumed_data = session()->WritevData( 190 QuicConsumedData consumed_data = session()->WritevData(
186 id(), iov, iov_count, stream_bytes_written_, fin, ack_notifier_delegate); 191 id(), data, stream_bytes_written_, fin, ack_notifier_delegate);
187 stream_bytes_written_ += consumed_data.bytes_consumed; 192 stream_bytes_written_ += consumed_data.bytes_consumed;
188 if (consumed_data.bytes_consumed == write_length) { 193 if (consumed_data.bytes_consumed == write_length) {
189 if (fin && consumed_data.fin_consumed) { 194 if (fin && consumed_data.fin_consumed) {
190 fin_sent_ = true; 195 fin_sent_ = true;
191 CloseWriteSide(); 196 CloseWriteSide();
192 } else if (fin && !consumed_data.fin_consumed) { 197 } else if (fin && !consumed_data.fin_consumed) {
193 session_->MarkWriteBlocked(id(), EffectivePriority()); 198 session_->MarkWriteBlocked(id(), EffectivePriority());
194 } 199 }
195 } else { 200 } else {
196 session_->MarkWriteBlocked(id(), EffectivePriority()); 201 session_->MarkWriteBlocked(id(), EffectivePriority());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // For flow control accounting, we must tell the peer how many bytes we have 242 // For flow control accounting, we must tell the peer how many bytes we have
238 // written on this stream before termination. Done here if needed, using a 243 // written on this stream before termination. Done here if needed, using a
239 // RST frame. 244 // RST frame.
240 DVLOG(1) << ENDPOINT << "Sending RST in OnClose: " << id(); 245 DVLOG(1) << ENDPOINT << "Sending RST in OnClose: " << id();
241 session_->SendRstStream(id(), QUIC_STREAM_NO_ERROR, stream_bytes_written_); 246 session_->SendRstStream(id(), QUIC_STREAM_NO_ERROR, stream_bytes_written_);
242 rst_sent_ = true; 247 rst_sent_ = true;
243 } 248 }
244 } 249 }
245 250
246 } // namespace net 251 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_utils.cc ('k') | net/quic/reliable_quic_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698