OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This is the interface from the QuicConnection into the QUIC | 5 // This is the interface from the QuicConnection into the QUIC |
6 // congestion control code. It wraps the SendAlgorithmInterface and | 6 // congestion control code. It wraps the SendAlgorithmInterface and |
7 // ReceiveAlgorithmInterface and provides a single interface | 7 // ReceiveAlgorithmInterface and provides a single interface |
8 // for consumers. | 8 // for consumers. |
9 | 9 |
10 #ifndef NET_QUIC_CONGESTION_CONTROL_QUIC_CONGESTION_MANAGER_H_ | 10 #ifndef NET_QUIC_CONGESTION_CONTROL_QUIC_CONGESTION_MANAGER_H_ |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 virtual void RecordIncomingPacket(QuicByteCount bytes, | 80 virtual void RecordIncomingPacket(QuicByteCount bytes, |
81 QuicPacketSequenceNumber sequence_number, | 81 QuicPacketSequenceNumber sequence_number, |
82 QuicTime timestamp, | 82 QuicTime timestamp, |
83 bool revived); | 83 bool revived); |
84 | 84 |
85 const QuicTime::Delta DefaultRetransmissionTime(); | 85 const QuicTime::Delta DefaultRetransmissionTime(); |
86 | 86 |
87 // Returns amount of time for delayed ack timer. | 87 // Returns amount of time for delayed ack timer. |
88 const QuicTime::Delta DelayedAckTime(); | 88 const QuicTime::Delta DelayedAckTime(); |
89 | 89 |
| 90 // Returns the current RTO delay. |unacked_packet_count| is the number of |
| 91 // currently outstanding packets. |number_retransmissions| is the number of |
| 92 // sequential retransmission timeouts that have occrued. |
90 const QuicTime::Delta GetRetransmissionDelay( | 93 const QuicTime::Delta GetRetransmissionDelay( |
91 size_t unacked_packets_count, | 94 size_t unacked_packets_count, |
92 size_t number_retransmissions) const; | 95 size_t number_retransmissions) const; |
93 | 96 |
94 // Returns the estimated smoothed RTT calculated by the congestion algorithm. | 97 // Returns the estimated smoothed RTT calculated by the congestion algorithm. |
95 const QuicTime::Delta SmoothedRtt() const; | 98 const QuicTime::Delta SmoothedRtt() const; |
96 | 99 |
97 // Returns the estimated bandwidth calculated by the congestion algorithm. | 100 // Returns the estimated bandwidth calculated by the congestion algorithm. |
98 QuicBandwidth BandwidthEstimate() const; | 101 QuicBandwidth BandwidthEstimate() const; |
99 | 102 |
100 // Returns the size of the current congestion window in bytes. Note, this is | 103 // Returns the size of the current congestion window in bytes. Note, this is |
101 // not the *available* window. Some send algorithms may not use a congestion | 104 // not the *available* window. Some send algorithms may not use a congestion |
102 // window and will return 0. | 105 // window and will return 0. |
103 QuicByteCount GetCongestionWindow() const; | 106 QuicByteCount GetCongestionWindow() const; |
104 | 107 |
105 // Sets the value of the current congestion window to |window|. | 108 // Sets the value of the current congestion window to |window|. |
106 void SetCongestionWindow(QuicByteCount window); | 109 void SetCongestionWindow(QuicByteCount window); |
107 | 110 |
108 private: | 111 private: |
109 friend class test::QuicConnectionPeer; | 112 friend class test::QuicConnectionPeer; |
110 friend class test::QuicCongestionManagerPeer; | 113 friend class test::QuicCongestionManagerPeer; |
111 typedef std::map<QuicPacketSequenceNumber, size_t> PendingPacketsMap; | 114 typedef std::map<QuicPacketSequenceNumber, size_t> PendingPacketsMap; |
112 | 115 |
113 // Get the current(last) rtt. Infinite is returned if invalid. | |
114 const QuicTime::Delta rtt(); | |
115 | |
116 void CleanupPacketHistory(); | 116 void CleanupPacketHistory(); |
117 | 117 |
118 const QuicClock* clock_; | 118 const QuicClock* clock_; |
119 scoped_ptr<ReceiveAlgorithmInterface> receive_algorithm_; | 119 scoped_ptr<ReceiveAlgorithmInterface> receive_algorithm_; |
120 scoped_ptr<SendAlgorithmInterface> send_algorithm_; | 120 scoped_ptr<SendAlgorithmInterface> send_algorithm_; |
121 SendAlgorithmInterface::SentPacketsMap packet_history_map_; | 121 SendAlgorithmInterface::SentPacketsMap packet_history_map_; |
122 PendingPacketsMap pending_packets_; | 122 PendingPacketsMap pending_packets_; |
123 QuicPacketSequenceNumber largest_missing_; | 123 QuicPacketSequenceNumber largest_missing_; |
124 QuicTime::Delta current_rtt_; | 124 QuicTime::Delta rtt_sample_; // RTT estimate from the most recent ACK. |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(QuicCongestionManager); | 126 DISALLOW_COPY_AND_ASSIGN(QuicCongestionManager); |
127 }; | 127 }; |
128 | 128 |
129 } // namespace net | 129 } // namespace net |
130 | 130 |
131 #endif // NET_QUIC_CONGESTION_CONTROL_QUIC_CONGESTION_MANAGER_H_ | 131 #endif // NET_QUIC_CONGESTION_CONTROL_QUIC_CONGESTION_MANAGER_H_ |
OLD | NEW |