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

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

Issue 286143007: Update QuicSentPacketManager to sample a new recent min rtt within the (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Created 6 years, 7 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 | « no previous file | net/quic/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/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 20 matching lines...) Expand all
31 31
32 // Only exponentially back off the handshake timer 5 times due to a timeout. 32 // Only exponentially back off the handshake timer 5 times due to a timeout.
33 static const size_t kMaxHandshakeRetransmissionBackoffs = 5; 33 static const size_t kMaxHandshakeRetransmissionBackoffs = 5;
34 static const size_t kMinHandshakeTimeoutMs = 10; 34 static const size_t kMinHandshakeTimeoutMs = 10;
35 35
36 // Sends up to two tail loss probes before firing an RTO, 36 // Sends up to two tail loss probes before firing an RTO,
37 // per draft RFC draft-dukkipati-tcpm-tcp-loss-probe. 37 // per draft RFC draft-dukkipati-tcpm-tcp-loss-probe.
38 static const size_t kDefaultMaxTailLossProbes = 2; 38 static const size_t kDefaultMaxTailLossProbes = 2;
39 static const int64 kMinTailLossProbeTimeoutMs = 10; 39 static const int64 kMinTailLossProbeTimeoutMs = 10;
40 40
41 // Number of samples before we force a new recent min rtt to be captured.
42 static const size_t kNumMinRttSamplesAfterQuiescence = 2;
43
41 bool HasCryptoHandshake(const TransmissionInfo& transmission_info) { 44 bool HasCryptoHandshake(const TransmissionInfo& transmission_info) {
42 if (transmission_info.retransmittable_frames == NULL) { 45 if (transmission_info.retransmittable_frames == NULL) {
43 return false; 46 return false;
44 } 47 }
45 return transmission_info.retransmittable_frames->HasCryptoHandshake() == 48 return transmission_info.retransmittable_frames->HasCryptoHandshake() ==
46 IS_HANDSHAKE; 49 IS_HANDSHAKE;
47 } 50 }
48 51
49 } // namespace 52 } // namespace
50 53
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 TransmissionType transmission_type, 440 TransmissionType transmission_type,
438 HasRetransmittableData has_retransmittable_data) { 441 HasRetransmittableData has_retransmittable_data) {
439 DCHECK_LT(0u, sequence_number); 442 DCHECK_LT(0u, sequence_number);
440 LOG_IF(DFATAL, bytes == 0) << "Cannot send empty packets."; 443 LOG_IF(DFATAL, bytes == 0) << "Cannot send empty packets.";
441 // In rare circumstances, the packet could be serialized, sent, and then acked 444 // In rare circumstances, the packet could be serialized, sent, and then acked
442 // before OnPacketSent is called. 445 // before OnPacketSent is called.
443 if (!unacked_packets_.IsUnacked(sequence_number)) { 446 if (!unacked_packets_.IsUnacked(sequence_number)) {
444 return false; 447 return false;
445 } 448 }
446 449
450 if (unacked_packets_.bytes_in_flight() == 0) {
451 // TODO(ianswett): Consider being less aggressive to force a new
452 // recent_min_rtt, likely by not discarding a relatively new sample.
453 DVLOG(1) << "Sampling a new recent min rtt within 2 samples. currently:"
454 << rtt_stats_.recent_min_rtt().ToMilliseconds() << "ms";
455 rtt_stats_.SampleNewRecentMinRtt(kNumMinRttSamplesAfterQuiescence);
456 }
457
447 // Only track packets as pending that the send algorithm wants us to track. 458 // Only track packets as pending that the send algorithm wants us to track.
448 const bool pending = 459 const bool pending =
449 send_algorithm_->OnPacketSent(sent_time, 460 send_algorithm_->OnPacketSent(sent_time,
450 unacked_packets_.bytes_in_flight(), 461 unacked_packets_.bytes_in_flight(),
451 sequence_number, 462 sequence_number,
452 bytes, 463 bytes,
453 has_retransmittable_data); 464 has_retransmittable_data);
454 unacked_packets_.SetSent(sequence_number, sent_time, bytes, pending); 465 unacked_packets_.SetSent(sequence_number, sent_time, bytes, pending);
455 466
456 // Reset the retransmission timer anytime a pending packet is sent. 467 // Reset the retransmission timer anytime a pending packet is sent.
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 return; 774 return;
764 } 775 }
765 776
766 using_pacing_ = true; 777 using_pacing_ = true;
767 send_algorithm_.reset( 778 send_algorithm_.reset(
768 new PacingSender(send_algorithm_.release(), 779 new PacingSender(send_algorithm_.release(),
769 QuicTime::Delta::FromMicroseconds(1))); 780 QuicTime::Delta::FromMicroseconds(1)));
770 } 781 }
771 782
772 } // namespace net 783 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698