| 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/core/quic_sent_packet_manager.h" | 5 #include "net/quic/core/quic_sent_packet_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 use_new_rto_ = true; | 141 use_new_rto_ = true; |
| 142 } | 142 } |
| 143 if (config.HasReceivedConnectionOptions() && | 143 if (config.HasReceivedConnectionOptions() && |
| 144 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) { | 144 ContainsQuicTag(config.ReceivedConnectionOptions(), kTIME)) { |
| 145 general_loss_algorithm_.SetLossDetectionType(kTime); | 145 general_loss_algorithm_.SetLossDetectionType(kTime); |
| 146 } | 146 } |
| 147 if (config.HasReceivedConnectionOptions() && | 147 if (config.HasReceivedConnectionOptions() && |
| 148 ContainsQuicTag(config.ReceivedConnectionOptions(), kATIM)) { | 148 ContainsQuicTag(config.ReceivedConnectionOptions(), kATIM)) { |
| 149 general_loss_algorithm_.SetLossDetectionType(kAdaptiveTime); | 149 general_loss_algorithm_.SetLossDetectionType(kAdaptiveTime); |
| 150 } | 150 } |
| 151 if (FLAGS_quic_loss_recovery_use_largest_acked && | 151 if (config.HasClientSentConnectionOption(kUNDO, perspective_)) { |
| 152 config.HasClientSentConnectionOption(kUNDO, perspective_)) { | |
| 153 undo_pending_retransmits_ = true; | 152 undo_pending_retransmits_ = true; |
| 154 } | 153 } |
| 155 send_algorithm_->SetFromConfig(config, perspective_); | 154 send_algorithm_->SetFromConfig(config, perspective_); |
| 156 | 155 |
| 157 if (network_change_visitor_ != nullptr) { | 156 if (network_change_visitor_ != nullptr) { |
| 158 network_change_visitor_->OnCongestionChange(); | 157 network_change_visitor_->OnCongestionChange(); |
| 159 } | 158 } |
| 160 } | 159 } |
| 161 | 160 |
| 162 void QuicSentPacketManager::ResumeConnectionState( | 161 void QuicSentPacketManager::ResumeConnectionState( |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 (!ack_frame.missing && !ack_frame.packets.Contains(packet_number))) { | 297 (!ack_frame.missing && !ack_frame.packets.Contains(packet_number))) { |
| 299 // Packet is still missing. | 298 // Packet is still missing. |
| 300 continue; | 299 continue; |
| 301 } | 300 } |
| 302 // Packet was acked, so remove it from our unacked packet list. | 301 // Packet was acked, so remove it from our unacked packet list. |
| 303 DVLOG(1) << ENDPOINT << "Got an ack for packet " << packet_number; | 302 DVLOG(1) << ENDPOINT << "Got an ack for packet " << packet_number; |
| 304 // If data is associated with the most recent transmission of this | 303 // If data is associated with the most recent transmission of this |
| 305 // packet, then inform the caller. | 304 // packet, then inform the caller. |
| 306 if (it->in_flight) { | 305 if (it->in_flight) { |
| 307 packets_acked_.push_back(std::make_pair(packet_number, it->bytes_sent)); | 306 packets_acked_.push_back(std::make_pair(packet_number, it->bytes_sent)); |
| 308 } else if (FLAGS_quic_loss_recovery_use_largest_acked && | 307 } else if (!it->is_unackable) { |
| 309 !it->is_unackable) { | 308 // Packets are marked unackable after they've been acked once. |
| 310 largest_newly_acked_ = packet_number; | 309 largest_newly_acked_ = packet_number; |
| 311 } | 310 } |
| 312 MarkPacketHandled(packet_number, &(*it), ack_delay_time); | 311 MarkPacketHandled(packet_number, &(*it), ack_delay_time); |
| 313 } | 312 } |
| 314 } | 313 } |
| 315 | 314 |
| 316 void QuicSentPacketManager::RetransmitUnackedPackets( | 315 void QuicSentPacketManager::RetransmitUnackedPackets( |
| 317 TransmissionType retransmission_type) { | 316 TransmissionType retransmission_type) { |
| 318 DCHECK(retransmission_type == ALL_UNACKED_RETRANSMISSION || | 317 DCHECK(retransmission_type == ALL_UNACKED_RETRANSMISSION || |
| 319 retransmission_type == ALL_INITIAL_RETRANSMISSION); | 318 retransmission_type == ALL_INITIAL_RETRANSMISSION); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 } | 506 } |
| 508 } | 507 } |
| 509 | 508 |
| 510 if (network_change_visitor_ != nullptr && | 509 if (network_change_visitor_ != nullptr && |
| 511 info->bytes_sent > largest_mtu_acked_) { | 510 info->bytes_sent > largest_mtu_acked_) { |
| 512 largest_mtu_acked_ = info->bytes_sent; | 511 largest_mtu_acked_ = info->bytes_sent; |
| 513 network_change_visitor_->OnPathMtuIncreased(largest_mtu_acked_); | 512 network_change_visitor_->OnPathMtuIncreased(largest_mtu_acked_); |
| 514 } | 513 } |
| 515 unacked_packets_.RemoveFromInFlight(info); | 514 unacked_packets_.RemoveFromInFlight(info); |
| 516 unacked_packets_.RemoveRetransmittability(info); | 515 unacked_packets_.RemoveRetransmittability(info); |
| 517 if (FLAGS_quic_loss_recovery_use_largest_acked) { | 516 info->is_unackable = true; |
| 518 info->is_unackable = true; | |
| 519 } | |
| 520 } | 517 } |
| 521 | 518 |
| 522 bool QuicSentPacketManager::HasUnackedPackets() const { | 519 bool QuicSentPacketManager::HasUnackedPackets() const { |
| 523 return unacked_packets_.HasUnackedPackets(); | 520 return unacked_packets_.HasUnackedPackets(); |
| 524 } | 521 } |
| 525 | 522 |
| 526 QuicPacketNumber QuicSentPacketManager::GetLeastUnacked(QuicPathId) const { | 523 QuicPacketNumber QuicSentPacketManager::GetLeastUnacked(QuicPathId) const { |
| 527 return unacked_packets_.GetLeastUnacked(); | 524 return unacked_packets_.GetLeastUnacked(); |
| 528 } | 525 } |
| 529 | 526 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 } | 689 } |
| 693 if (consecutive_tlp_count_ < max_tail_loss_probes_) { | 690 if (consecutive_tlp_count_ < max_tail_loss_probes_) { |
| 694 if (unacked_packets_.HasUnackedRetransmittableFrames()) { | 691 if (unacked_packets_.HasUnackedRetransmittableFrames()) { |
| 695 return TLP_MODE; | 692 return TLP_MODE; |
| 696 } | 693 } |
| 697 } | 694 } |
| 698 return RTO_MODE; | 695 return RTO_MODE; |
| 699 } | 696 } |
| 700 | 697 |
| 701 void QuicSentPacketManager::InvokeLossDetection(QuicTime time) { | 698 void QuicSentPacketManager::InvokeLossDetection(QuicTime time) { |
| 702 if (FLAGS_quic_loss_recovery_use_largest_acked && !packets_acked_.empty()) { | 699 if (!packets_acked_.empty()) { |
| 703 DCHECK_LE(packets_acked_.front().first, packets_acked_.back().first); | 700 DCHECK_LE(packets_acked_.front().first, packets_acked_.back().first); |
| 704 largest_newly_acked_ = packets_acked_.back().first; | 701 largest_newly_acked_ = packets_acked_.back().first; |
| 705 } | 702 } |
| 706 loss_algorithm_->DetectLosses(unacked_packets_, time, rtt_stats_, | 703 loss_algorithm_->DetectLosses(unacked_packets_, time, rtt_stats_, |
| 707 largest_newly_acked_, &packets_lost_); | 704 largest_newly_acked_, &packets_lost_); |
| 708 for (const auto& pair : packets_lost_) { | 705 for (const auto& pair : packets_lost_) { |
| 709 ++stats_->packets_lost; | 706 ++stats_->packets_lost; |
| 710 if (debug_delegate_ != nullptr) { | 707 if (debug_delegate_ != nullptr) { |
| 711 debug_delegate_->OnPacketLoss(pair.first, LOSS_RETRANSMISSION, time); | 708 debug_delegate_->OnPacketLoss(pair.first, LOSS_RETRANSMISSION, time); |
| 712 } | 709 } |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 | 994 |
| 998 void QuicSentPacketManager::RemoveObsoletePackets() { | 995 void QuicSentPacketManager::RemoveObsoletePackets() { |
| 999 unacked_packets_.RemoveObsoletePackets(); | 996 unacked_packets_.RemoveObsoletePackets(); |
| 1000 } | 997 } |
| 1001 | 998 |
| 1002 void QuicSentPacketManager::OnApplicationLimited() { | 999 void QuicSentPacketManager::OnApplicationLimited() { |
| 1003 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); | 1000 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); |
| 1004 } | 1001 } |
| 1005 | 1002 |
| 1006 } // namespace net | 1003 } // namespace net |
| OLD | NEW |