| 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 18 matching lines...) Expand all Loading... |
| 29 static const int64_t kDefaultRetransmissionTimeMs = 500; | 29 static const int64_t kDefaultRetransmissionTimeMs = 500; |
| 30 // TCP RFC calls for 1 second RTO however Linux differs from this default and | 30 // TCP RFC calls for 1 second RTO however Linux differs from this default and |
| 31 // define the minimum RTO to 200ms, we will use the same until we have data to | 31 // define the minimum RTO to 200ms, we will use the same until we have data to |
| 32 // support a higher or lower value. | 32 // support a higher or lower value. |
| 33 static const int64_t kMinRetransmissionTimeMs = 200; | 33 static const int64_t kMinRetransmissionTimeMs = 200; |
| 34 static const int64_t kMaxRetransmissionTimeMs = 60000; | 34 static const int64_t kMaxRetransmissionTimeMs = 60000; |
| 35 // Maximum number of exponential backoffs used for RTO timeouts. | 35 // Maximum number of exponential backoffs used for RTO timeouts. |
| 36 static const size_t kMaxRetransmissions = 10; | 36 static const size_t kMaxRetransmissions = 10; |
| 37 // Maximum number of packets retransmitted upon an RTO. | 37 // Maximum number of packets retransmitted upon an RTO. |
| 38 static const size_t kMaxRetransmissionsOnTimeout = 2; | 38 static const size_t kMaxRetransmissionsOnTimeout = 2; |
| 39 // Minimum number of consecutive RTOs before path is considered to be degrading. |
| 40 const size_t kMinTimeoutsBeforePathDegrading = 2; |
| 39 | 41 |
| 40 // Ensure the handshake timer isnt't faster than 10ms. | 42 // Ensure the handshake timer isnt't faster than 10ms. |
| 41 // This limits the tenth retransmitted packet to 10s after the initial CHLO. | 43 // This limits the tenth retransmitted packet to 10s after the initial CHLO. |
| 42 static const int64_t kMinHandshakeTimeoutMs = 10; | 44 static const int64_t kMinHandshakeTimeoutMs = 10; |
| 43 | 45 |
| 44 // Sends up to two tail loss probes before firing an RTO, | 46 // Sends up to two tail loss probes before firing an RTO, |
| 45 // per draft RFC draft-dukkipati-tcpm-tcp-loss-probe. | 47 // per draft RFC draft-dukkipati-tcpm-tcp-loss-probe. |
| 46 static const size_t kDefaultMaxTailLossProbes = 2; | 48 static const size_t kDefaultMaxTailLossProbes = 2; |
| 47 static const int64_t kMinTailLossProbeTimeoutMs = 10; | 49 static const int64_t kMinTailLossProbeTimeoutMs = 10; |
| 48 | 50 |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 // packets, execute a conventional RTO to abandon old packets. | 617 // packets, execute a conventional RTO to abandon old packets. |
| 616 ++stats_->tlp_count; | 618 ++stats_->tlp_count; |
| 617 ++consecutive_tlp_count_; | 619 ++consecutive_tlp_count_; |
| 618 pending_timer_transmission_count_ = 1; | 620 pending_timer_transmission_count_ = 1; |
| 619 // TLPs prefer sending new data instead of retransmitting data, so | 621 // TLPs prefer sending new data instead of retransmitting data, so |
| 620 // give the connection a chance to write before completing the TLP. | 622 // give the connection a chance to write before completing the TLP. |
| 621 return; | 623 return; |
| 622 case RTO_MODE: | 624 case RTO_MODE: |
| 623 ++stats_->rto_count; | 625 ++stats_->rto_count; |
| 624 RetransmitRtoPackets(); | 626 RetransmitRtoPackets(); |
| 627 if (network_change_visitor_ != nullptr && |
| 628 consecutive_rto_count_ == kMinTimeoutsBeforePathDegrading) { |
| 629 network_change_visitor_->OnPathDegrading(); |
| 630 } |
| 625 return; | 631 return; |
| 626 } | 632 } |
| 627 } | 633 } |
| 628 | 634 |
| 629 void QuicSentPacketManager::RetransmitCryptoPackets() { | 635 void QuicSentPacketManager::RetransmitCryptoPackets() { |
| 630 DCHECK_EQ(HANDSHAKE_MODE, GetRetransmissionMode()); | 636 DCHECK_EQ(HANDSHAKE_MODE, GetRetransmissionMode()); |
| 631 ++consecutive_crypto_retransmission_count_; | 637 ++consecutive_crypto_retransmission_count_; |
| 632 bool packet_retransmitted = false; | 638 bool packet_retransmitted = false; |
| 633 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); | 639 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); |
| 634 for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); | 640 for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( | 1010 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( |
| 1005 QuicPacketNumber packet_number) { | 1011 QuicPacketNumber packet_number) { |
| 1006 return unacked_packets_.GetMutableTransmissionInfo(packet_number); | 1012 return unacked_packets_.GetMutableTransmissionInfo(packet_number); |
| 1007 } | 1013 } |
| 1008 | 1014 |
| 1009 void QuicSentPacketManager::RemoveObsoletePackets() { | 1015 void QuicSentPacketManager::RemoveObsoletePackets() { |
| 1010 unacked_packets_.RemoveObsoletePackets(); | 1016 unacked_packets_.RemoveObsoletePackets(); |
| 1011 } | 1017 } |
| 1012 | 1018 |
| 1013 } // namespace net | 1019 } // namespace net |
| OLD | NEW |