| 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 "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "net/quic/crypto/crypto_framer.h" | 9 #include "net/quic/crypto/crypto_framer.h" |
| 10 #include "net/quic/crypto/crypto_handshake_message.h" | 10 #include "net/quic/crypto/crypto_handshake_message.h" |
| (...skipping 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2042 | 2042 |
| 2043 // TODO(satyamshekhar): Decide how often we really should send this | 2043 // TODO(satyamshekhar): Decide how often we really should send this |
| 2044 // entropy_hash update. | 2044 // entropy_hash update. |
| 2045 if (!writer->WriteUInt8(frame.sent_info.entropy_hash)) { | 2045 if (!writer->WriteUInt8(frame.sent_info.entropy_hash)) { |
| 2046 return false; | 2046 return false; |
| 2047 } | 2047 } |
| 2048 | 2048 |
| 2049 DCHECK_GE(header.packet_sequence_number, frame.sent_info.least_unacked); | 2049 DCHECK_GE(header.packet_sequence_number, frame.sent_info.least_unacked); |
| 2050 const QuicPacketSequenceNumber least_unacked_delta = | 2050 const QuicPacketSequenceNumber least_unacked_delta = |
| 2051 header.packet_sequence_number - frame.sent_info.least_unacked; | 2051 header.packet_sequence_number - frame.sent_info.least_unacked; |
| 2052 const QuicPacketSequenceNumber length_shift = |
| 2053 header.public_header.sequence_number_length * 8; |
| 2054 if (least_unacked_delta >> length_shift > 0) { |
| 2055 LOG(DFATAL) << "sequence_number_length " |
| 2056 << header.public_header.sequence_number_length |
| 2057 << " is too small for least_unacked_delta: " |
| 2058 << least_unacked_delta; |
| 2059 return false; |
| 2060 } |
| 2052 if (!AppendPacketSequenceNumber(header.public_header.sequence_number_length, | 2061 if (!AppendPacketSequenceNumber(header.public_header.sequence_number_length, |
| 2053 least_unacked_delta, writer)) { | 2062 least_unacked_delta, writer)) { |
| 2054 return false; | 2063 return false; |
| 2055 } | 2064 } |
| 2056 | 2065 |
| 2057 const ReceivedPacketInfo& received_info = frame.received_info; | 2066 const ReceivedPacketInfo& received_info = frame.received_info; |
| 2058 QuicPacketEntropyHash ack_entropy_hash = received_info.entropy_hash; | 2067 QuicPacketEntropyHash ack_entropy_hash = received_info.entropy_hash; |
| 2059 NackRangeMap::reverse_iterator ack_iter = ack_info.nack_ranges.rbegin(); | 2068 NackRangeMap::reverse_iterator ack_iter = ack_info.nack_ranges.rbegin(); |
| 2060 if (truncated) { | 2069 if (truncated) { |
| 2061 // Skip the nack ranges which the truncated ack won't include and set | 2070 // Skip the nack ranges which the truncated ack won't include and set |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2322 | 2331 |
| 2323 bool QuicFramer::RaiseError(QuicErrorCode error) { | 2332 bool QuicFramer::RaiseError(QuicErrorCode error) { |
| 2324 DVLOG(1) << "Error detail: " << detailed_error_; | 2333 DVLOG(1) << "Error detail: " << detailed_error_; |
| 2325 set_error(error); | 2334 set_error(error); |
| 2326 visitor_->OnError(this); | 2335 visitor_->OnError(this); |
| 2327 reader_.reset(NULL); | 2336 reader_.reset(NULL); |
| 2328 return false; | 2337 return false; |
| 2329 } | 2338 } |
| 2330 | 2339 |
| 2331 } // namespace net | 2340 } // namespace net |
| OLD | NEW |