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

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

Issue 20227003: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Land Recent QUIC changes Created 7 years, 5 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_stream_sequencer.h ('k') | net/quic/quic_stream_sequencer_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/quic_stream_sequencer.h" 5 #include "net/quic/quic_stream_sequencer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 if (!WillAcceptStreamFrame(frame)) { 67 if (!WillAcceptStreamFrame(frame)) {
68 // This should not happen, as WillAcceptFrame should be called before 68 // This should not happen, as WillAcceptFrame should be called before
69 // OnStreamFrame. Error handling should be done by the caller. 69 // OnStreamFrame. Error handling should be done by the caller.
70 return false; 70 return false;
71 } 71 }
72 if (IsDuplicate(frame)) { 72 if (IsDuplicate(frame)) {
73 // Silently ignore duplicates. 73 // Silently ignore duplicates.
74 return true; 74 return true;
75 } 75 }
76 76
77 if (frame.fin) {
78 CloseStreamAtOffset(frame.offset + frame.data.size());
79 }
80
77 QuicStreamOffset byte_offset = frame.offset; 81 QuicStreamOffset byte_offset = frame.offset;
78 const char* data = frame.data.data(); 82 const char* data = frame.data.data();
79 size_t data_len = frame.data.size(); 83 size_t data_len = frame.data.size();
80 84
85 if (data_len == 0) {
86 // TODO(rch): Close the stream if there was no data and no fin.
87 return true;
88 }
89
81 if (byte_offset == num_bytes_consumed_) { 90 if (byte_offset == num_bytes_consumed_) {
82 DVLOG(1) << "Processing byte offset " << byte_offset; 91 DVLOG(1) << "Processing byte offset " << byte_offset;
83 size_t bytes_consumed = stream_->ProcessRawData(data, data_len); 92 size_t bytes_consumed = stream_->ProcessRawData(data, data_len);
84 num_bytes_consumed_ += bytes_consumed; 93 num_bytes_consumed_ += bytes_consumed;
85 94
86 if (MaybeCloseStream()) { 95 if (MaybeCloseStream()) {
87 return true; 96 return true;
88 } 97 }
89 if (bytes_consumed > data_len) { 98 if (bytes_consumed > data_len) {
90 stream_->Close(QUIC_SERVER_ERROR_PROCESSING_STREAM); 99 stream_->Close(QUIC_SERVER_ERROR_PROCESSING_STREAM);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 } else { 261 } else {
253 string new_data = it->second.substr(bytes_consumed); 262 string new_data = it->second.substr(bytes_consumed);
254 frames_.erase(it); 263 frames_.erase(it);
255 frames_.insert(make_pair(num_bytes_consumed_, new_data)); 264 frames_.insert(make_pair(num_bytes_consumed_, new_data));
256 return; 265 return;
257 } 266 }
258 } 267 }
259 } 268 }
260 269
261 } // namespace net 270 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_stream_sequencer.h ('k') | net/quic/quic_stream_sequencer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698