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 23 matching lines...) Expand all Loading... |
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. | 41 // Number of samples before we force a new recent min rtt to be captured. |
42 static const size_t kNumMinRttSamplesAfterQuiescence = 2; | 42 static const size_t kNumMinRttSamplesAfterQuiescence = 2; |
43 | 43 |
| 44 // Number of unpaced packets to send after quiescence. |
| 45 static const size_t kInitialUnpacedBurst = 10; |
| 46 |
44 bool HasCryptoHandshake(const TransmissionInfo& transmission_info) { | 47 bool HasCryptoHandshake(const TransmissionInfo& transmission_info) { |
45 if (transmission_info.retransmittable_frames == NULL) { | 48 if (transmission_info.retransmittable_frames == NULL) { |
46 return false; | 49 return false; |
47 } | 50 } |
48 return transmission_info.retransmittable_frames->HasCryptoHandshake() == | 51 return transmission_info.retransmittable_frames->HasCryptoHandshake() == |
49 IS_HANDSHAKE; | 52 IS_HANDSHAKE; |
50 } | 53 } |
51 | 54 |
52 } // namespace | 55 } // namespace |
53 | 56 |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 } | 783 } |
781 | 784 |
782 const RttStats* QuicSentPacketManager::GetRttStats() const { | 785 const RttStats* QuicSentPacketManager::GetRttStats() const { |
783 return &rtt_stats_; | 786 return &rtt_stats_; |
784 } | 787 } |
785 | 788 |
786 QuicBandwidth QuicSentPacketManager::BandwidthEstimate() const { | 789 QuicBandwidth QuicSentPacketManager::BandwidthEstimate() const { |
787 return send_algorithm_->BandwidthEstimate(); | 790 return send_algorithm_->BandwidthEstimate(); |
788 } | 791 } |
789 | 792 |
| 793 bool QuicSentPacketManager::HasReliableBandwidthEstimate() const { |
| 794 return send_algorithm_->HasReliableBandwidthEstimate(); |
| 795 } |
| 796 |
790 QuicByteCount QuicSentPacketManager::GetCongestionWindow() const { | 797 QuicByteCount QuicSentPacketManager::GetCongestionWindow() const { |
791 return send_algorithm_->GetCongestionWindow(); | 798 return send_algorithm_->GetCongestionWindow(); |
792 } | 799 } |
793 | 800 |
794 void QuicSentPacketManager::MaybeEnablePacing() { | 801 void QuicSentPacketManager::MaybeEnablePacing() { |
795 if (!FLAGS_enable_quic_pacing) { | 802 if (!FLAGS_enable_quic_pacing) { |
796 return; | 803 return; |
797 } | 804 } |
798 | 805 |
799 if (using_pacing_) { | 806 if (using_pacing_) { |
800 return; | 807 return; |
801 } | 808 } |
802 | 809 |
803 // Set up a pacing sender with a 5 millisecond alarm granularity. | 810 // Set up a pacing sender with a 5 millisecond alarm granularity. |
804 using_pacing_ = true; | 811 using_pacing_ = true; |
805 send_algorithm_.reset( | 812 send_algorithm_.reset( |
806 new PacingSender(send_algorithm_.release(), | 813 new PacingSender(send_algorithm_.release(), |
807 QuicTime::Delta::FromMilliseconds(5))); | 814 QuicTime::Delta::FromMilliseconds(5), |
| 815 kInitialUnpacedBurst)); |
808 } | 816 } |
809 | 817 |
810 } // namespace net | 818 } // namespace net |
OLD | NEW |