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> |
11 | 11 |
12 #include "net/quic/core/quic_packets.h" | 12 #include "net/quic/core/quic_packets.h" |
13 #include "net/quic/core/quic_stream.h" | 13 #include "net/quic/core/quic_stream.h" |
14 #include "net/quic/core/quic_stream_sequencer_buffer.h" | 14 #include "net/quic/core/quic_stream_sequencer_buffer.h" |
15 #include "net/quic/core/quic_utils.h" | 15 #include "net/quic/core/quic_utils.h" |
16 #include "net/quic/platform/api/quic_bug_tracker.h" | 16 #include "net/quic/platform/api/quic_bug_tracker.h" |
17 #include "net/quic/platform/api/quic_clock.h" | 17 #include "net/quic/platform/api/quic_clock.h" |
18 #include "net/quic/platform/api/quic_logging.h" | 18 #include "net/quic/platform/api/quic_logging.h" |
19 #include "net/quic/platform/api/quic_str_cat.h" | 19 #include "net/quic/platform/api/quic_str_cat.h" |
| 20 #include "net/quic/platform/api/quic_string_piece.h" |
20 | 21 |
21 using base::StringPiece; | |
22 using std::string; | 22 using std::string; |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 | 25 |
26 QuicStreamSequencer::QuicStreamSequencer(QuicStream* quic_stream, | 26 QuicStreamSequencer::QuicStreamSequencer(QuicStream* quic_stream, |
27 const QuicClock* clock) | 27 const QuicClock* clock) |
28 : stream_(quic_stream), | 28 : stream_(quic_stream), |
29 buffered_frames_(kStreamReceiveWindowLimit), | 29 buffered_frames_(kStreamReceiveWindowLimit), |
30 close_offset_(std::numeric_limits<QuicStreamOffset>::max()), | 30 close_offset_(std::numeric_limits<QuicStreamOffset>::max()), |
31 blocked_(false), | 31 blocked_(false), |
(...skipping 11 matching lines...) Expand all Loading... |
43 | 43 |
44 if (frame.fin) { | 44 if (frame.fin) { |
45 CloseStreamAtOffset(frame.offset + data_len); | 45 CloseStreamAtOffset(frame.offset + data_len); |
46 if (data_len == 0) { | 46 if (data_len == 0) { |
47 return; | 47 return; |
48 } | 48 } |
49 } | 49 } |
50 size_t bytes_written; | 50 size_t bytes_written; |
51 string error_details; | 51 string error_details; |
52 QuicErrorCode result = buffered_frames_.OnStreamData( | 52 QuicErrorCode result = buffered_frames_.OnStreamData( |
53 byte_offset, StringPiece(frame.data_buffer, frame.data_length), | 53 byte_offset, QuicStringPiece(frame.data_buffer, frame.data_length), |
54 clock_->ApproximateNow(), &bytes_written, &error_details); | 54 clock_->ApproximateNow(), &bytes_written, &error_details); |
55 if (result != QUIC_NO_ERROR) { | 55 if (result != QUIC_NO_ERROR) { |
56 string details = QuicStrCat( | 56 string details = QuicStrCat( |
57 "Stream ", stream_->id(), ": ", QuicErrorCodeToString(result), ": ", | 57 "Stream ", stream_->id(), ": ", QuicErrorCodeToString(result), ": ", |
58 error_details, "\nPeer Address: ", | 58 error_details, "\nPeer Address: ", |
59 stream_->PeerAddressOfLatestPacket().ToString()); | 59 stream_->PeerAddressOfLatestPacket().ToString()); |
60 QUIC_LOG_FIRST_N(WARNING, 50) << QuicErrorCodeToString(result); | 60 QUIC_LOG_FIRST_N(WARNING, 50) << QuicErrorCodeToString(result); |
61 QUIC_LOG_FIRST_N(WARNING, 50) << details; | 61 QUIC_LOG_FIRST_N(WARNING, 50) << details; |
62 stream_->CloseConnectionWithDetails(result, details); | 62 stream_->CloseConnectionWithDetails(result, details); |
63 return; | 63 return; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 "\n bytes buffered: ", NumBytesBuffered(), | 220 "\n bytes buffered: ", NumBytesBuffered(), |
221 "\n bytes consumed: ", NumBytesConsumed(), | 221 "\n bytes consumed: ", NumBytesConsumed(), |
222 "\n has bytes to read: ", HasBytesToRead() ? "true" : "false", | 222 "\n has bytes to read: ", HasBytesToRead() ? "true" : "false", |
223 "\n frames received: ", num_frames_received(), | 223 "\n frames received: ", num_frames_received(), |
224 "\n close offset bytes: ", close_offset_, | 224 "\n close offset bytes: ", close_offset_, |
225 "\n is closed: ", IsClosed() ? "true" : "false"); | 225 "\n is closed: ", IsClosed() ? "true" : "false"); |
226 // clang-format on | 226 // clang-format on |
227 } | 227 } |
228 | 228 |
229 } // namespace net | 229 } // namespace net |
OLD | NEW |