| 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_sent_packet_manager.h" | 5 #include "net/quic/quic_sent_packet_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 264 |
| 265 if (debug_delegate_ != nullptr) { | 265 if (debug_delegate_ != nullptr) { |
| 266 debug_delegate_->OnIncomingAck(ack_frame, ack_receive_time, | 266 debug_delegate_->OnIncomingAck(ack_frame, ack_receive_time, |
| 267 unacked_packets_.largest_observed(), | 267 unacked_packets_.largest_observed(), |
| 268 rtt_updated, GetLeastUnacked()); | 268 rtt_updated, GetLeastUnacked()); |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 | 271 |
| 272 void QuicSentPacketManager::UpdatePacketInformationReceivedByPeer( | 272 void QuicSentPacketManager::UpdatePacketInformationReceivedByPeer( |
| 273 const QuicAckFrame& ack_frame) { | 273 const QuicAckFrame& ack_frame) { |
| 274 if (ack_frame.missing_packets.empty()) { | 274 if (ack_frame.missing_packets.Empty()) { |
| 275 least_packet_awaited_by_peer_ = ack_frame.largest_observed + 1; | 275 least_packet_awaited_by_peer_ = ack_frame.largest_observed + 1; |
| 276 } else { | 276 } else { |
| 277 least_packet_awaited_by_peer_ = *(ack_frame.missing_packets.begin()); | 277 least_packet_awaited_by_peer_ = ack_frame.missing_packets.Min(); |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 | 280 |
| 281 void QuicSentPacketManager::MaybeInvokeCongestionEvent( | 281 void QuicSentPacketManager::MaybeInvokeCongestionEvent( |
| 282 bool rtt_updated, QuicByteCount bytes_in_flight) { | 282 bool rtt_updated, QuicByteCount bytes_in_flight) { |
| 283 if (!rtt_updated && packets_acked_.empty() && packets_lost_.empty()) { | 283 if (!rtt_updated && packets_acked_.empty() && packets_lost_.empty()) { |
| 284 return; | 284 return; |
| 285 } | 285 } |
| 286 send_algorithm_->OnCongestionEvent(rtt_updated, bytes_in_flight, | 286 send_algorithm_->OnCongestionEvent(rtt_updated, bytes_in_flight, |
| 287 packets_acked_, packets_lost_); | 287 packets_acked_, packets_lost_); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 299 QuicTime::Delta delta_largest_observed = | 299 QuicTime::Delta delta_largest_observed = |
| 300 ack_frame.delta_time_largest_observed; | 300 ack_frame.delta_time_largest_observed; |
| 301 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); | 301 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); |
| 302 for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); | 302 for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); |
| 303 it != unacked_packets_.end(); ++it, ++packet_number) { | 303 it != unacked_packets_.end(); ++it, ++packet_number) { |
| 304 if (packet_number > ack_frame.largest_observed) { | 304 if (packet_number > ack_frame.largest_observed) { |
| 305 // These packets are still in flight. | 305 // These packets are still in flight. |
| 306 break; | 306 break; |
| 307 } | 307 } |
| 308 | 308 |
| 309 if (ContainsKey(ack_frame.missing_packets, packet_number)) { | 309 if (ack_frame.missing_packets.Contains(packet_number)) { |
| 310 // Don't continue to increase the nack count for packets not in flight. | 310 // Don't continue to increase the nack count for packets not in flight. |
| 311 if (!it->in_flight) { | 311 if (!it->in_flight) { |
| 312 continue; | 312 continue; |
| 313 } | 313 } |
| 314 // Consider it multiple nacks when there is a gap between the missing | 314 // Consider it multiple nacks when there is a gap between the missing |
| 315 // packet and the largest observed, since the purpose of a nack | 315 // packet and the largest observed, since the purpose of a nack |
| 316 // threshold is to tolerate re-ordering. This handles both StretchAcks | 316 // threshold is to tolerate re-ordering. This handles both StretchAcks |
| 317 // and Forward Acks. | 317 // and Forward Acks. |
| 318 // The nack count only increases when the largest observed increases. | 318 // The nack count only increases when the largest observed increases. |
| 319 QuicPacketCount min_nacks = ack_frame.largest_observed - packet_number; | 319 QuicPacketCount min_nacks = ack_frame.largest_observed - packet_number; |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as | 944 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as |
| 945 // the default granularity of the Linux kernel's FQ qdisc. | 945 // the default granularity of the Linux kernel's FQ qdisc. |
| 946 using_pacing_ = true; | 946 using_pacing_ = true; |
| 947 send_algorithm_.reset( | 947 send_algorithm_.reset( |
| 948 new PacingSender(send_algorithm_.release(), | 948 new PacingSender(send_algorithm_.release(), |
| 949 QuicTime::Delta::FromMilliseconds(1), | 949 QuicTime::Delta::FromMilliseconds(1), |
| 950 kInitialUnpacedBurst)); | 950 kInitialUnpacedBurst)); |
| 951 } | 951 } |
| 952 | 952 |
| 953 } // namespace net | 953 } // namespace net |
| OLD | NEW |