Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: net/quic/core/quic_sent_packet_manager.cc

Issue 2393933002: Move the logic from SendAlgorithmInterface::RetransmissionDelay() into QuicSentPacketManager, becau… (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_connection_test.cc ('k') | net/quic/core/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 if (!unacked_packets_.HasMultipleInFlightPackets()) { 852 if (!unacked_packets_.HasMultipleInFlightPackets()) {
853 return std::max(2 * srtt, 1.5 * srtt + QuicTime::Delta::FromMilliseconds( 853 return std::max(2 * srtt, 1.5 * srtt + QuicTime::Delta::FromMilliseconds(
854 kMinRetransmissionTimeMs / 2)); 854 kMinRetransmissionTimeMs / 2));
855 } 855 }
856 return QuicTime::Delta::FromMilliseconds( 856 return QuicTime::Delta::FromMilliseconds(
857 max(kMinTailLossProbeTimeoutMs, 857 max(kMinTailLossProbeTimeoutMs,
858 static_cast<int64_t>(2 * srtt.ToMilliseconds()))); 858 static_cast<int64_t>(2 * srtt.ToMilliseconds())));
859 } 859 }
860 860
861 const QuicTime::Delta QuicSentPacketManager::GetRetransmissionDelay() const { 861 const QuicTime::Delta QuicSentPacketManager::GetRetransmissionDelay() const {
862 QuicTime::Delta retransmission_delay = send_algorithm_->RetransmissionDelay(); 862 QuicTime::Delta retransmission_delay = QuicTime::Delta::Zero();
863 if (retransmission_delay.IsZero()) { 863 if (rtt_stats_.smoothed_rtt().IsZero()) {
864 // We are in the initial state, use default timeout values. 864 // We are in the initial state, use default timeout values.
865 retransmission_delay = 865 retransmission_delay =
866 QuicTime::Delta::FromMilliseconds(kDefaultRetransmissionTimeMs); 866 QuicTime::Delta::FromMilliseconds(kDefaultRetransmissionTimeMs);
867 } else if (retransmission_delay.ToMilliseconds() < kMinRetransmissionTimeMs) { 867 } else {
868 retransmission_delay = 868 retransmission_delay =
869 QuicTime::Delta::FromMilliseconds(kMinRetransmissionTimeMs); 869 rtt_stats_.smoothed_rtt() + 4 * rtt_stats_.mean_deviation();
870 if (retransmission_delay.ToMilliseconds() < kMinRetransmissionTimeMs) {
871 retransmission_delay =
872 QuicTime::Delta::FromMilliseconds(kMinRetransmissionTimeMs);
873 }
870 } 874 }
871 875
872 // Calculate exponential back off. 876 // Calculate exponential back off.
873 retransmission_delay = 877 retransmission_delay =
874 retransmission_delay * 878 retransmission_delay *
875 (1 << min<size_t>(consecutive_rto_count_, kMaxRetransmissions)); 879 (1 << min<size_t>(consecutive_rto_count_, kMaxRetransmissions));
876 880
877 if (retransmission_delay.ToMilliseconds() > kMaxRetransmissionTimeMs) { 881 if (retransmission_delay.ToMilliseconds() > kMaxRetransmissionTimeMs) {
878 return QuicTime::Delta::FromMilliseconds(kMaxRetransmissionTimeMs); 882 return QuicTime::Delta::FromMilliseconds(kMaxRetransmissionTimeMs);
879 } 883 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 // Rtt and cwnd do not need to be reset when the peer address change is 955 // Rtt and cwnd do not need to be reset when the peer address change is
952 // considered to be caused by NATs. 956 // considered to be caused by NATs.
953 return; 957 return;
954 } 958 }
955 consecutive_rto_count_ = 0; 959 consecutive_rto_count_ = 0;
956 consecutive_tlp_count_ = 0; 960 consecutive_tlp_count_ = 0;
957 rtt_stats_.OnConnectionMigration(); 961 rtt_stats_.OnConnectionMigration();
958 send_algorithm_->OnConnectionMigration(); 962 send_algorithm_->OnConnectionMigration();
959 } 963 }
960 964
961
962 void QuicSentPacketManager::SetDebugDelegate(DebugDelegate* debug_delegate) { 965 void QuicSentPacketManager::SetDebugDelegate(DebugDelegate* debug_delegate) {
963 debug_delegate_ = debug_delegate; 966 debug_delegate_ = debug_delegate;
964 } 967 }
965 968
966 QuicPacketNumber QuicSentPacketManager::GetLargestObserved(QuicPathId) const { 969 QuicPacketNumber QuicSentPacketManager::GetLargestObserved(QuicPathId) const {
967 return unacked_packets_.largest_observed(); 970 return unacked_packets_.largest_observed();
968 } 971 }
969 972
970 QuicPacketNumber QuicSentPacketManager::GetLargestSentPacket(QuicPathId) const { 973 QuicPacketNumber QuicSentPacketManager::GetLargestSentPacket(QuicPathId) const {
971 return unacked_packets_.largest_sent_packet(); 974 return unacked_packets_.largest_sent_packet();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 1006
1004 void QuicSentPacketManager::RemoveObsoletePackets() { 1007 void QuicSentPacketManager::RemoveObsoletePackets() {
1005 unacked_packets_.RemoveObsoletePackets(); 1008 unacked_packets_.RemoveObsoletePackets();
1006 } 1009 }
1007 1010
1008 void QuicSentPacketManager::OnApplicationLimited() { 1011 void QuicSentPacketManager::OnApplicationLimited() {
1009 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); 1012 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight());
1010 } 1013 }
1011 1014
1012 } // namespace net 1015 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_connection_test.cc ('k') | net/quic/core/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698