OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_received_packet_manager.h" | 5 #include "net/quic/quic_received_packet_manager.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "net/base/linked_hash_map.h" | 9 #include "net/base/linked_hash_map.h" |
10 | 10 |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 received_info_.revived_packets.begin(), | 200 received_info_.revived_packets.begin(), |
201 received_info_.revived_packets.lower_bound(least_unacked)); | 201 received_info_.revived_packets.lower_bound(least_unacked)); |
202 size_t missing_packets_count = received_info_.missing_packets.size(); | 202 size_t missing_packets_count = received_info_.missing_packets.size(); |
203 received_info_.missing_packets.erase( | 203 received_info_.missing_packets.erase( |
204 received_info_.missing_packets.begin(), | 204 received_info_.missing_packets.begin(), |
205 received_info_.missing_packets.lower_bound(least_unacked)); | 205 received_info_.missing_packets.lower_bound(least_unacked)); |
206 return missing_packets_count != received_info_.missing_packets.size(); | 206 return missing_packets_count != received_info_.missing_packets.size(); |
207 } | 207 } |
208 | 208 |
209 void QuicReceivedPacketManager::UpdatePacketInformationSentByPeer( | 209 void QuicReceivedPacketManager::UpdatePacketInformationSentByPeer( |
210 const SentPacketInfo& sent_info) { | 210 const QuicStopWaitingFrame& stop_waiting) { |
211 // ValidateAck() should fail if peer_least_packet_awaiting_ack_ shrinks. | 211 // ValidateAck() should fail if peer_least_packet_awaiting_ack_ shrinks. |
212 DCHECK_LE(peer_least_packet_awaiting_ack_, sent_info.least_unacked); | 212 DCHECK_LE(peer_least_packet_awaiting_ack_, stop_waiting.least_unacked); |
213 if (sent_info.least_unacked > peer_least_packet_awaiting_ack_) { | 213 if (stop_waiting.least_unacked > peer_least_packet_awaiting_ack_) { |
214 bool missed_packets = DontWaitForPacketsBefore(sent_info.least_unacked); | 214 bool missed_packets = DontWaitForPacketsBefore(stop_waiting.least_unacked); |
215 if (missed_packets || sent_info.least_unacked > | 215 if (missed_packets || stop_waiting.least_unacked > |
216 received_info_.largest_observed + 1) { | 216 received_info_.largest_observed + 1) { |
217 DVLOG(1) << "Updating entropy hashed since we missed packets"; | 217 DVLOG(1) << "Updating entropy hashed since we missed packets"; |
218 // There were some missing packets that we won't ever get now. Recalculate | 218 // There were some missing packets that we won't ever get now. Recalculate |
219 // the received entropy hash. | 219 // the received entropy hash. |
220 RecalculateEntropyHash(sent_info.least_unacked, sent_info.entropy_hash); | 220 RecalculateEntropyHash(stop_waiting.least_unacked, |
| 221 stop_waiting.entropy_hash); |
221 } | 222 } |
222 peer_least_packet_awaiting_ack_ = sent_info.least_unacked; | 223 peer_least_packet_awaiting_ack_ = stop_waiting.least_unacked; |
223 } | 224 } |
224 DCHECK(received_info_.missing_packets.empty() || | 225 DCHECK(received_info_.missing_packets.empty() || |
225 *received_info_.missing_packets.begin() >= | 226 *received_info_.missing_packets.begin() >= |
226 peer_least_packet_awaiting_ack_); | 227 peer_least_packet_awaiting_ack_); |
227 } | 228 } |
228 | 229 |
229 bool QuicReceivedPacketManager::HasMissingPackets() { | 230 bool QuicReceivedPacketManager::HasMissingPackets() { |
230 return !received_info_.missing_packets.empty(); | 231 return !received_info_.missing_packets.empty(); |
231 } | 232 } |
232 | 233 |
233 bool QuicReceivedPacketManager::HasNewMissingPackets() { | 234 bool QuicReceivedPacketManager::HasNewMissingPackets() { |
234 return HasMissingPackets() && | 235 return HasMissingPackets() && |
235 (received_info_.largest_observed - | 236 (received_info_.largest_observed - |
236 *received_info_.missing_packets.rbegin()) <= kMaxPacketsAfterNewMissing; | 237 *received_info_.missing_packets.rbegin()) <= kMaxPacketsAfterNewMissing; |
237 } | 238 } |
238 | 239 |
239 } // namespace net | 240 } // namespace net |
OLD | NEW |