| 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/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 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/strings/string_number_conversions.h" |
| 13 #include "net/quic/quic_bug_tracker.h" | 14 #include "net/quic/quic_bug_tracker.h" |
| 14 #include "net/quic/quic_clock.h" | 15 #include "net/quic/quic_clock.h" |
| 15 #include "net/quic/quic_flags.h" | 16 #include "net/quic/quic_flags.h" |
| 16 #include "net/quic/quic_protocol.h" | 17 #include "net/quic/quic_protocol.h" |
| 17 #include "net/quic/quic_stream_sequencer_buffer.h" | 18 #include "net/quic/quic_stream_sequencer_buffer.h" |
| 18 #include "net/quic/quic_utils.h" | 19 #include "net/quic/quic_utils.h" |
| 19 #include "net/quic/reliable_quic_stream.h" | 20 #include "net/quic/reliable_quic_stream.h" |
| 20 | 21 |
| 21 using base::StringPiece; | 22 using base::StringPiece; |
| 22 using std::min; | 23 using std::min; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 49 if (data_len == 0) { | 50 if (data_len == 0) { |
| 50 return; | 51 return; |
| 51 } | 52 } |
| 52 } | 53 } |
| 53 size_t bytes_written; | 54 size_t bytes_written; |
| 54 string error_details; | 55 string error_details; |
| 55 QuicErrorCode result = buffered_frames_.OnStreamData( | 56 QuicErrorCode result = buffered_frames_.OnStreamData( |
| 56 byte_offset, StringPiece(frame.data_buffer, frame.data_length), | 57 byte_offset, StringPiece(frame.data_buffer, frame.data_length), |
| 57 clock_->ApproximateNow(), &bytes_written, &error_details); | 58 clock_->ApproximateNow(), &bytes_written, &error_details); |
| 58 if (result != QUIC_NO_ERROR) { | 59 if (result != QUIC_NO_ERROR) { |
| 60 string details = "Stream" + base::Uint64ToString(stream_->id()) + ": " + |
| 61 QuicUtils::ErrorToString(result) + ": " + error_details + |
| 62 "\nPeer Address: " + |
| 63 stream_->PeerAddressOfLatestPacket().ToString(); |
| 59 DLOG(WARNING) << QuicUtils::ErrorToString(result); | 64 DLOG(WARNING) << QuicUtils::ErrorToString(result); |
| 60 DLOG(WARNING) << error_details; | 65 DLOG(WARNING) << details; |
| 61 stream_->CloseConnectionWithDetails(result, error_details); | 66 stream_->CloseConnectionWithDetails(result, details); |
| 62 return; | 67 return; |
| 63 } | 68 } |
| 64 | 69 |
| 65 if (bytes_written == 0) { | 70 if (bytes_written == 0) { |
| 66 ++num_duplicate_frames_received_; | 71 ++num_duplicate_frames_received_; |
| 67 // Silently ignore duplicates. | 72 // Silently ignore duplicates. |
| 68 return; | 73 return; |
| 69 } | 74 } |
| 70 | 75 |
| 71 if (byte_offset > buffered_frames_.BytesConsumed()) { | 76 if (byte_offset > buffered_frames_.BytesConsumed()) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 196 |
| 192 size_t QuicStreamSequencer::NumBytesBuffered() const { | 197 size_t QuicStreamSequencer::NumBytesBuffered() const { |
| 193 return buffered_frames_.BytesBuffered(); | 198 return buffered_frames_.BytesBuffered(); |
| 194 } | 199 } |
| 195 | 200 |
| 196 QuicStreamOffset QuicStreamSequencer::NumBytesConsumed() const { | 201 QuicStreamOffset QuicStreamSequencer::NumBytesConsumed() const { |
| 197 return buffered_frames_.BytesConsumed(); | 202 return buffered_frames_.BytesConsumed(); |
| 198 } | 203 } |
| 199 | 204 |
| 200 } // namespace net | 205 } // namespace net |
| OLD | NEW |