| Index: net/quic/quic_sent_packet_manager.cc
|
| diff --git a/net/quic/quic_sent_packet_manager.cc b/net/quic/quic_sent_packet_manager.cc
|
| index d8a8ce8ba07be82c11ece995617be05504554c20..8592ea711b0a0bcc74538b6a284cf026f25a6e95 100644
|
| --- a/net/quic/quic_sent_packet_manager.cc
|
| +++ b/net/quic/quic_sent_packet_manager.cc
|
| @@ -71,9 +71,9 @@ QuicSentPacketManager::QuicSentPacketManager(bool is_server,
|
| is_server_(is_server),
|
| clock_(clock),
|
| stats_(stats),
|
| - send_algorithm_(SendAlgorithmInterface::Create(clock, type, stats)),
|
| + send_algorithm_(
|
| + SendAlgorithmInterface::Create(clock, &rtt_stats_, type, stats)),
|
| loss_algorithm_(LossDetectionInterface::Create()),
|
| - rtt_sample_(QuicTime::Delta::Infinite()),
|
| largest_observed_(0),
|
| consecutive_rto_count_(0),
|
| consecutive_tlp_count_(0),
|
| @@ -86,14 +86,11 @@ QuicSentPacketManager::~QuicSentPacketManager() {
|
| }
|
|
|
| void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) {
|
| - if (config.initial_round_trip_time_us() > 0 &&
|
| - rtt_sample_.IsInfinite()) {
|
| + if (config.initial_round_trip_time_us() > 0) {
|
| // The initial rtt should already be set on the client side.
|
| DVLOG_IF(1, !is_server_)
|
| << "Client did not set an initial RTT, but did negotiate one.";
|
| - rtt_sample_ =
|
| - QuicTime::Delta::FromMicroseconds(config.initial_round_trip_time_us());
|
| - send_algorithm_->UpdateRtt(rtt_sample_);
|
| + rtt_stats_.set_initial_rtt_us(config.initial_round_trip_time_us());
|
| }
|
| if (config.congestion_control() == kPACE) {
|
| MaybeEnablePacing();
|
| @@ -553,8 +550,7 @@ void QuicSentPacketManager::InvokeLossDetection(QuicTime time) {
|
| loss_algorithm_->DetectLostPackets(unacked_packets_,
|
| time,
|
| largest_observed_,
|
| - send_algorithm_->SmoothedRtt(),
|
| - rtt_sample_);
|
| + rtt_stats_);
|
| for (SequenceNumberSet::const_iterator it = lost_packets.begin();
|
| it != lost_packets.end(); ++it) {
|
| QuicPacketSequenceNumber sequence_number = *it;
|
| @@ -594,16 +590,8 @@ void QuicSentPacketManager::MaybeUpdateRTT(
|
|
|
| QuicTime::Delta send_delta =
|
| ack_receive_time.Subtract(transmission_info.sent_time);
|
| - if (send_delta > received_info.delta_time_largest_observed) {
|
| - rtt_sample_ = send_delta.Subtract(
|
| - received_info.delta_time_largest_observed);
|
| - } else if (rtt_sample_.IsInfinite()) {
|
| - // Even though we received information from the peer suggesting
|
| - // an invalid (negative) RTT, we can use the send delta as an
|
| - // approximation until we get a better estimate.
|
| - rtt_sample_ = send_delta;
|
| - }
|
| - send_algorithm_->UpdateRtt(rtt_sample_);
|
| + rtt_stats_.UpdateRtt(send_delta, received_info.delta_time_largest_observed);
|
| + send_algorithm_->UpdateRtt(rtt_stats_.latest_rtt());
|
| }
|
|
|
| QuicTime::Delta QuicSentPacketManager::TimeUntilSend(
|
| @@ -657,10 +645,10 @@ const QuicTime QuicSentPacketManager::GetRetransmissionTime() const {
|
| // The RTO is based on the first pending packet.
|
| const QuicTime sent_time =
|
| unacked_packets_.GetFirstPendingPacketSentTime();
|
| - // Always wait at least 1.5 * RTT after the first sent packet.
|
| + QuicTime rto_timeout = sent_time.Add(GetRetransmissionDelay());
|
| + // Always wait at least 1.5 * RTT from now.
|
| QuicTime min_timeout = clock_->ApproximateNow().Add(
|
| SmoothedRtt().Multiply(1.5));
|
| - QuicTime rto_timeout = sent_time.Add(GetRetransmissionDelay());
|
|
|
| return QuicTime::Max(min_timeout, rto_timeout);
|
| }
|
| @@ -713,7 +701,7 @@ const QuicTime::Delta QuicSentPacketManager::GetRetransmissionDelay() const {
|
| }
|
|
|
| const QuicTime::Delta QuicSentPacketManager::SmoothedRtt() const {
|
| - return send_algorithm_->SmoothedRtt();
|
| + return rtt_stats_.SmoothedRtt();
|
| }
|
|
|
| QuicBandwidth QuicSentPacketManager::BandwidthEstimate() const {
|
|
|