OLD | NEW |
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/core/quic_stream_sequencer.h" | 5 #include "net/quic/core/quic_stream_sequencer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 DCHECK(!blocked_); | 135 DCHECK(!blocked_); |
136 return buffered_frames_.GetReadableRegion(iov, timestamp); | 136 return buffered_frames_.GetReadableRegion(iov, timestamp); |
137 } | 137 } |
138 | 138 |
139 int QuicStreamSequencer::Readv(const struct iovec* iov, size_t iov_len) { | 139 int QuicStreamSequencer::Readv(const struct iovec* iov, size_t iov_len) { |
140 DCHECK(!blocked_); | 140 DCHECK(!blocked_); |
141 string error_details; | 141 string error_details; |
142 size_t bytes_read; | 142 size_t bytes_read; |
143 QuicErrorCode read_error = | 143 QuicErrorCode read_error = |
144 buffered_frames_.Readv(iov, iov_len, &bytes_read, &error_details); | 144 buffered_frames_.Readv(iov, iov_len, &bytes_read, &error_details); |
145 if (FLAGS_quic_stream_sequencer_buffer_debug && read_error != QUIC_NO_ERROR) { | 145 if (read_error != QUIC_NO_ERROR) { |
146 string details = StringPrintf("Stream %" PRIu32 ": %s", stream_->id(), | 146 string details = StringPrintf("Stream %" PRIu32 ": %s", stream_->id(), |
147 error_details.c_str()); | 147 error_details.c_str()); |
148 stream_->CloseConnectionWithDetails(read_error, details); | 148 stream_->CloseConnectionWithDetails(read_error, details); |
149 return static_cast<int>(bytes_read); | 149 return static_cast<int>(bytes_read); |
150 } | 150 } |
151 | 151 |
152 stream_->AddBytesConsumed(bytes_read); | 152 stream_->AddBytesConsumed(bytes_read); |
153 return static_cast<int>(bytes_read); | 153 return static_cast<int>(bytes_read); |
154 } | 154 } |
155 | 155 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 "\n bytes buffered: " + IntToString(NumBytesBuffered()) + | 227 "\n bytes buffered: " + IntToString(NumBytesBuffered()) + |
228 "\n bytes consumed: " + IntToString( NumBytesConsumed()) + | 228 "\n bytes consumed: " + IntToString( NumBytesConsumed()) + |
229 "\n has bytes to read: " + (HasBytesToRead() ? "true" : "false") + | 229 "\n has bytes to read: " + (HasBytesToRead() ? "true" : "false") + |
230 "\n frames received: " + IntToString(num_frames_received()) + | 230 "\n frames received: " + IntToString(num_frames_received()) + |
231 "\n close offset bytes: " + IntToString( close_offset_) + | 231 "\n close offset bytes: " + IntToString( close_offset_) + |
232 "\n is closed: " + (IsClosed() ? "true" : "false"); | 232 "\n is closed: " + (IsClosed() ? "true" : "false"); |
233 // clang-format on | 233 // clang-format on |
234 } | 234 } |
235 | 235 |
236 } // namespace net | 236 } // namespace net |
OLD | NEW |