| 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_framer.h" | 5 #include "net/quic/quic_framer.h" |
| 6 | 6 |
| 7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
| 8 #include "net/quic/crypto/quic_decrypter.h" | 8 #include "net/quic/crypto/quic_decrypter.h" |
| 9 #include "net/quic/crypto/quic_encrypter.h" | 9 #include "net/quic/crypto/quic_encrypter.h" |
| 10 #include "net/quic/quic_data_reader.h" | 10 #include "net/quic/quic_data_reader.h" |
| (...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2019 // Determine whether we need to truncate ranges. | 2019 // Determine whether we need to truncate ranges. |
| 2020 size_t available_range_bytes = writer->capacity() - writer->length() - | 2020 size_t available_range_bytes = writer->capacity() - writer->length() - |
| 2021 GetMinAckFrameSize(quic_version_, | 2021 GetMinAckFrameSize(quic_version_, |
| 2022 header.public_header.sequence_number_length, | 2022 header.public_header.sequence_number_length, |
| 2023 largest_observed_length); | 2023 largest_observed_length); |
| 2024 size_t max_num_ranges = available_range_bytes / | 2024 size_t max_num_ranges = available_range_bytes / |
| 2025 (missing_sequence_number_length + PACKET_1BYTE_SEQUENCE_NUMBER); | 2025 (missing_sequence_number_length + PACKET_1BYTE_SEQUENCE_NUMBER); |
| 2026 max_num_ranges = | 2026 max_num_ranges = |
| 2027 min(static_cast<size_t>(numeric_limits<uint8>::max()), max_num_ranges); | 2027 min(static_cast<size_t>(numeric_limits<uint8>::max()), max_num_ranges); |
| 2028 bool truncated = ack_info.nack_ranges.size() > max_num_ranges; | 2028 bool truncated = ack_info.nack_ranges.size() > max_num_ranges; |
| 2029 DLOG_IF(INFO, truncated) << "Truncating ack from " | 2029 DVLOG_IF(0, truncated) << "Truncating ack from " |
| 2030 << ack_info.nack_ranges.size() << " ranges to " | 2030 << ack_info.nack_ranges.size() << " ranges to " |
| 2031 << max_num_ranges; | 2031 << max_num_ranges; |
| 2032 | 2032 |
| 2033 // Write out the type byte by setting the low order bits and doing shifts | 2033 // Write out the type byte by setting the low order bits and doing shifts |
| 2034 // to make room for the next bit flags to be set. | 2034 // to make room for the next bit flags to be set. |
| 2035 // Whether there are any nacks. | 2035 // Whether there are any nacks. |
| 2036 uint8 type_byte = ack_info.nack_ranges.empty() ? 0 : kQuicHasNacksMask; | 2036 uint8 type_byte = ack_info.nack_ranges.empty() ? 0 : kQuicHasNacksMask; |
| 2037 | 2037 |
| 2038 // truncating bit. | 2038 // truncating bit. |
| 2039 type_byte <<= kQuicAckTruncatedShift; | 2039 type_byte <<= kQuicAckTruncatedShift; |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2282 | 2282 |
| 2283 bool QuicFramer::RaiseError(QuicErrorCode error) { | 2283 bool QuicFramer::RaiseError(QuicErrorCode error) { |
| 2284 DVLOG(1) << detailed_error_; | 2284 DVLOG(1) << detailed_error_; |
| 2285 set_error(error); | 2285 set_error(error); |
| 2286 visitor_->OnError(this); | 2286 visitor_->OnError(this); |
| 2287 reader_.reset(NULL); | 2287 reader_.reset(NULL); |
| 2288 return false; | 2288 return false; |
| 2289 } | 2289 } |
| 2290 | 2290 |
| 2291 } // namespace net | 2291 } // namespace net |
| OLD | NEW |