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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 DCHECK_GE(frame.largest_observed, *frame.missing_packets.rbegin()); | 968 DCHECK_GE(frame.largest_observed, *frame.missing_packets.rbegin()); |
969 size_t cur_range_length = 0; | 969 size_t cur_range_length = 0; |
970 SequenceNumberSet::const_iterator iter = frame.missing_packets.begin(); | 970 SequenceNumberSet::const_iterator iter = frame.missing_packets.begin(); |
971 QuicPacketSequenceNumber last_missing = *iter; | 971 QuicPacketSequenceNumber last_missing = *iter; |
972 ++iter; | 972 ++iter; |
973 for (; iter != frame.missing_packets.end(); ++iter) { | 973 for (; iter != frame.missing_packets.end(); ++iter) { |
974 if (cur_range_length != numeric_limits<uint8>::max() && | 974 if (cur_range_length != numeric_limits<uint8>::max() && |
975 *iter == (last_missing + 1)) { | 975 *iter == (last_missing + 1)) { |
976 ++cur_range_length; | 976 ++cur_range_length; |
977 } else { | 977 } else { |
978 ack_info.nack_ranges[last_missing - cur_range_length] | 978 ack_info.nack_ranges[last_missing - cur_range_length] = |
979 = cur_range_length; | 979 cur_range_length; |
980 cur_range_length = 0; | 980 cur_range_length = 0; |
981 } | 981 } |
982 ack_info.max_delta = max(ack_info.max_delta, *iter - last_missing); | 982 ack_info.max_delta = max(ack_info.max_delta, *iter - last_missing); |
983 last_missing = *iter; | 983 last_missing = *iter; |
984 } | 984 } |
985 // Include the last nack range. | 985 // Include the last nack range. |
986 ack_info.nack_ranges[last_missing - cur_range_length] = | 986 ack_info.nack_ranges[last_missing - cur_range_length] = cur_range_length; |
987 cur_range_length; | |
988 // Include the range to the largest observed. | 987 // Include the range to the largest observed. |
989 ack_info.max_delta = max(ack_info.max_delta, | 988 ack_info.max_delta = max(ack_info.max_delta, |
990 frame.largest_observed - last_missing); | 989 frame.largest_observed - last_missing); |
991 } | 990 } |
992 return ack_info; | 991 return ack_info; |
993 } | 992 } |
994 | 993 |
995 bool QuicFramer::ProcessPacketHeader( | 994 bool QuicFramer::ProcessPacketHeader( |
996 QuicPacketHeader* header, | 995 QuicPacketHeader* header, |
997 const QuicEncryptedPacket& packet) { | 996 const QuicEncryptedPacket& packet) { |
(...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2265 | 2264 |
2266 bool QuicFramer::RaiseError(QuicErrorCode error) { | 2265 bool QuicFramer::RaiseError(QuicErrorCode error) { |
2267 DVLOG(1) << "Error detail: " << detailed_error_; | 2266 DVLOG(1) << "Error detail: " << detailed_error_; |
2268 set_error(error); | 2267 set_error(error); |
2269 visitor_->OnError(this); | 2268 visitor_->OnError(this); |
2270 reader_.reset(NULL); | 2269 reader_.reset(NULL); |
2271 return false; | 2270 return false; |
2272 } | 2271 } |
2273 | 2272 |
2274 } // namespace net | 2273 } // namespace net |
OLD | NEW |