| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "net/quic/congestion_control/pacing_sender.h" | 9 #include "net/quic/congestion_control/pacing_sender.h" |
| 10 #include "net/quic/quic_ack_notifier_manager.h" | 10 #include "net/quic/quic_ack_notifier_manager.h" |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 MarkForRetransmission(sequence_number, TLP_RETRANSMISSION); | 615 MarkForRetransmission(sequence_number, TLP_RETRANSMISSION); |
| 616 return; | 616 return; |
| 617 } | 617 } |
| 618 DLOG(FATAL) | 618 DLOG(FATAL) |
| 619 << "No retransmittable packets, so RetransmitOldestPacket failed."; | 619 << "No retransmittable packets, so RetransmitOldestPacket failed."; |
| 620 } | 620 } |
| 621 | 621 |
| 622 void QuicSentPacketManager::RetransmitAllPackets() { | 622 void QuicSentPacketManager::RetransmitAllPackets() { |
| 623 // Abandon all retransmittable packets and packets older than the | 623 // Abandon all retransmittable packets and packets older than the |
| 624 // retransmission delay. | 624 // retransmission delay. |
| 625 QuicTime::Delta retransmission_delay = GetRetransmissionDelay(); | |
| 626 QuicTime max_send_time = | |
| 627 clock_->ApproximateNow().Subtract(retransmission_delay); | |
| 628 | 625 |
| 629 DVLOG(1) << "OnRetransmissionTimeout() fired with " | 626 DVLOG(1) << "OnRetransmissionTimeout() fired with " |
| 630 << unacked_packets_.size() << " unacked packets."; | 627 << unacked_packets_.size() << " unacked packets."; |
| 631 | 628 |
| 632 // Request retransmission of all retransmittable packets when the RTO | 629 // Request retransmission of all retransmittable packets when the RTO |
| 633 // fires, and let the congestion manager decide how many to send | 630 // fires, and let the congestion manager decide how many to send |
| 634 // immediately and the remaining packets will be queued. | 631 // immediately and the remaining packets will be queued. |
| 635 // Abandon any non-retransmittable packets that are sufficiently old. | 632 // Abandon any non-retransmittable packets that are sufficiently old. |
| 636 bool packets_retransmitted = false; | 633 bool packets_retransmitted = false; |
| 637 for (UnackedPacketMap::const_iterator it = unacked_packets_.begin(); | 634 for (UnackedPacketMap::const_iterator it = unacked_packets_.begin(); |
| 638 it != unacked_packets_.end(); ++it) { | 635 it != unacked_packets_.end(); ++it) { |
| 639 if (it->second.retransmittable_frames != NULL) { | 636 if (it->second.retransmittable_frames != NULL) { |
| 640 OnPacketAbandoned(it->first); | |
| 641 packets_retransmitted = true; | 637 packets_retransmitted = true; |
| 642 MarkForRetransmission(it->first, RTO_RETRANSMISSION); | 638 MarkForRetransmission(it->first, RTO_RETRANSMISSION); |
| 643 } else if (it->second.sent_time <= max_send_time) { | |
| 644 OnPacketAbandoned(it->first); | |
| 645 } | 639 } |
| 646 } | 640 } |
| 647 | 641 |
| 648 // Only inform the send algorithm of an RTO if data was retransmitted. | 642 pending_packets_.clear(); |
| 643 send_algorithm_->OnRetransmissionTimeout(packets_retransmitted); |
| 649 if (packets_retransmitted) { | 644 if (packets_retransmitted) { |
| 650 ++consecutive_rto_count_; | 645 ++consecutive_rto_count_; |
| 651 send_algorithm_->OnRetransmissionTimeout(); | |
| 652 } | 646 } |
| 653 } | 647 } |
| 654 | 648 |
| 655 QuicSentPacketManager::RetransmissionTimeoutMode | 649 QuicSentPacketManager::RetransmissionTimeoutMode |
| 656 QuicSentPacketManager::GetRetransmissionMode() const { | 650 QuicSentPacketManager::GetRetransmissionMode() const { |
| 657 DCHECK(!pending_packets_.empty()); | 651 DCHECK(!pending_packets_.empty()); |
| 658 if (pending_crypto_packet_count_ > 0) { | 652 if (pending_crypto_packet_count_ > 0) { |
| 659 return HANDSHAKE_MODE; | 653 return HANDSHAKE_MODE; |
| 660 } | 654 } |
| 661 if (consecutive_tlp_count_ < max_tail_loss_probes_) { | 655 if (consecutive_tlp_count_ < max_tail_loss_probes_) { |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 return; | 931 return; |
| 938 } | 932 } |
| 939 | 933 |
| 940 using_pacing_ = true; | 934 using_pacing_ = true; |
| 941 send_algorithm_.reset( | 935 send_algorithm_.reset( |
| 942 new PacingSender(send_algorithm_.release(), | 936 new PacingSender(send_algorithm_.release(), |
| 943 QuicTime::Delta::FromMicroseconds(1))); | 937 QuicTime::Delta::FromMicroseconds(1))); |
| 944 } | 938 } |
| 945 | 939 |
| 946 } // namespace net | 940 } // namespace net |
| OLD | NEW |