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