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 #include "net/quic/congestion_control/tcp_cubic_sender.h" | 5 #include "net/quic/congestion_control/tcp_cubic_sender.h" |
6 | 6 |
7 namespace net { | 7 namespace net { |
8 | 8 |
9 namespace { | 9 namespace { |
10 // Constants based on TCP defaults. | 10 // Constants based on TCP defaults. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 congestion_window_ = 1; | 80 congestion_window_ = 1; |
81 } | 81 } |
82 DLOG(INFO) << "Incoming loss; congestion window:" << congestion_window_; | 82 DLOG(INFO) << "Incoming loss; congestion window:" << congestion_window_; |
83 } | 83 } |
84 | 84 |
85 void TcpCubicSender::SentPacket(QuicTime /*sent_time*/, | 85 void TcpCubicSender::SentPacket(QuicTime /*sent_time*/, |
86 QuicPacketSequenceNumber sequence_number, | 86 QuicPacketSequenceNumber sequence_number, |
87 QuicByteCount bytes, | 87 QuicByteCount bytes, |
88 Retransmission is_retransmission) { | 88 Retransmission is_retransmission) { |
89 bytes_in_flight_ += bytes; | 89 bytes_in_flight_ += bytes; |
90 if (!is_retransmission && update_end_sequence_number_) { | 90 if (is_retransmission == NOT_RETRANSMISSION && update_end_sequence_number_) { |
91 end_sequence_number_ = sequence_number; | 91 end_sequence_number_ = sequence_number; |
92 if (AvailableCongestionWindow() == 0) { | 92 if (AvailableCongestionWindow() == 0) { |
93 update_end_sequence_number_ = false; | 93 update_end_sequence_number_ = false; |
94 DLOG(INFO) << "Stop update end sequence number @" << sequence_number; | 94 DLOG(INFO) << "Stop update end sequence number @" << sequence_number; |
95 } | 95 } |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 void TcpCubicSender::AbandoningPacket(QuicPacketSequenceNumber sequence_number, | 99 void TcpCubicSender::AbandoningPacket(QuicPacketSequenceNumber sequence_number, |
100 QuicByteCount abandoned_bytes) { | 100 QuicByteCount abandoned_bytes) { |
101 bytes_in_flight_ -= abandoned_bytes; | 101 bytes_in_flight_ -= abandoned_bytes; |
102 } | 102 } |
103 | 103 |
104 QuicTime::Delta TcpCubicSender::TimeUntilSend( | 104 QuicTime::Delta TcpCubicSender::TimeUntilSend( |
105 QuicTime now, | 105 QuicTime now, |
106 Retransmission is_retransmission, | 106 Retransmission is_retransmission, |
107 HasRetransmittableData has_retransmittable_data) { | 107 HasRetransmittableData has_retransmittable_data) { |
108 if (is_retransmission || !has_retransmittable_data) { | 108 if (is_retransmission == IS_RETRANSMISSION || |
| 109 has_retransmittable_data == NO_RETRANSMITTABLE_DATA) { |
109 // For TCP we can always send a retransmission and/or an ACK immediately. | 110 // For TCP we can always send a retransmission and/or an ACK immediately. |
110 return QuicTime::Delta::Zero(); | 111 return QuicTime::Delta::Zero(); |
111 } | 112 } |
112 if (AvailableCongestionWindow() == 0) { | 113 if (AvailableCongestionWindow() == 0) { |
113 return QuicTime::Delta::Infinite(); | 114 return QuicTime::Delta::Infinite(); |
114 } | 115 } |
115 return QuicTime::Delta::Zero(); | 116 return QuicTime::Delta::Zero(); |
116 } | 117 } |
117 | 118 |
118 QuicByteCount TcpCubicSender::AvailableCongestionWindow() { | 119 QuicByteCount TcpCubicSender::AvailableCongestionWindow() { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 hybrid_slow_start_.Reset(end_sequence_number_); | 227 hybrid_slow_start_.Reset(end_sequence_number_); |
227 } | 228 } |
228 hybrid_slow_start_.Update(rtt, delay_min_); | 229 hybrid_slow_start_.Update(rtt, delay_min_); |
229 if (hybrid_slow_start_.Exit()) { | 230 if (hybrid_slow_start_.Exit()) { |
230 slowstart_threshold_ = congestion_window_; | 231 slowstart_threshold_ = congestion_window_; |
231 } | 232 } |
232 } | 233 } |
233 } | 234 } |
234 | 235 |
235 } // namespace net | 236 } // namespace net |
OLD | NEW |