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

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

Issue 1983183002: Landing Recent QUIC changes until 5/14/2016 02:25:25 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "first try to fix link error for win_clang build" Created 4 years, 7 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/quic_stream_sequencer.cc ('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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/quic_stream_sequencer_buffer.h" 5 #include "net/quic/quic_stream_sequencer_buffer.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "net/quic/quic_bug_tracker.h" 9 #include "net/quic/quic_bug_tracker.h"
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 offset + size <= current_gap->begin_offset) { 99 offset + size <= current_gap->begin_offset) {
100 DVLOG(1) << "Duplicated data at offset: " << offset << " length: " << size; 100 DVLOG(1) << "Duplicated data at offset: " << offset << " length: " << size;
101 return QUIC_NO_ERROR; 101 return QUIC_NO_ERROR;
102 } 102 }
103 if (offset < current_gap->begin_offset && 103 if (offset < current_gap->begin_offset &&
104 offset + size > current_gap->begin_offset) { 104 offset + size > current_gap->begin_offset) {
105 // Beginning of new data overlaps data before current gap. 105 // Beginning of new data overlaps data before current gap.
106 *error_details = 106 *error_details =
107 string("Beginning of received data overlaps with buffered data.\n") + 107 string("Beginning of received data overlaps with buffered data.\n") +
108 "New frame range " + RangeDebugString(offset, offset + size) + 108 "New frame range " + RangeDebugString(offset, offset + size) +
109 "\n" 109 " with first 128 bytes: " +
110 "Currently received frames: " + 110 string(data.data(), data.length() < 128 ? data.length() : 128) +
111 ReceivedFramesDebugString() + 111 "\nCurrently received frames: " + ReceivedFramesDebugString() +
112 "\n" 112 "\nCurrent gaps: " + GapsDebugString();
113 "Current gaps: " +
114 GapsDebugString() + "\n";
115 return QUIC_OVERLAPPING_STREAM_DATA; 113 return QUIC_OVERLAPPING_STREAM_DATA;
116 } 114 }
117 if (offset + size > current_gap->end_offset) { 115 if (offset + size > current_gap->end_offset) {
118 // End of new data overlaps with data after current gap. 116 // End of new data overlaps with data after current gap.
119 *error_details = 117 *error_details =
120 "End of received data overlaps with buffered data.\n" 118 string("End of received data overlaps with buffered data.\n") +
121 "New frame range " + 119 "New frame range " + RangeDebugString(offset, offset + size) +
122 RangeDebugString(offset, offset + size) + 120 " with first 128 bytes: " +
123 "\n" 121 string(data.data(), data.length() < 128 ? data.length() : 128) +
124 "Currently received frames: " + 122 "\nCurrently received frames: " + ReceivedFramesDebugString() +
125 ReceivedFramesDebugString() + 123 "\nCurrent gaps: " + GapsDebugString();
126 "\n"
127 "Current gaps: " +
128 GapsDebugString() + "\n";
129 return QUIC_OVERLAPPING_STREAM_DATA; 124 return QUIC_OVERLAPPING_STREAM_DATA;
130 } 125 }
131 126
132 // Write beyond the current range this buffer is covering. 127 // Write beyond the current range this buffer is covering.
133 if (offset + size > total_bytes_read_ + max_buffer_capacity_bytes_) { 128 if (offset + size > total_bytes_read_ + max_buffer_capacity_bytes_) {
134 *error_details = "Received data beyond available range."; 129 *error_details = "Received data beyond available range.";
135 return QUIC_INTERNAL_ERROR; 130 return QUIC_INTERNAL_ERROR;
136 } 131 }
137 132
138 size_t total_written = 0; 133 size_t total_written = 0;
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 QuicStreamOffset current_frame_begin_offset = it.first; 496 QuicStreamOffset current_frame_begin_offset = it.first;
502 QuicStreamOffset current_frame_end_offset = 497 QuicStreamOffset current_frame_end_offset =
503 it.second.length + current_frame_begin_offset; 498 it.second.length + current_frame_begin_offset;
504 current_frames_string += 499 current_frames_string +=
505 RangeDebugString(current_frame_begin_offset, current_frame_end_offset); 500 RangeDebugString(current_frame_begin_offset, current_frame_end_offset);
506 } 501 }
507 return current_frames_string; 502 return current_frames_string;
508 } 503 }
509 504
510 } // namespace net 505 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_stream_sequencer.cc ('k') | net/quic/quic_stream_sequencer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698