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 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "net/quic/congestion_control/rtt_stats.h" | 10 #include "net/quic/congestion_control/rtt_stats.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 const QuicCongestionFeedbackFrame& feedback, | 81 const QuicCongestionFeedbackFrame& feedback, |
82 QuicTime feedback_receive_time) { | 82 QuicTime feedback_receive_time) { |
83 if (feedback.type == kTCP) { | 83 if (feedback.type == kTCP) { |
84 receive_window_ = feedback.tcp.receive_window; | 84 receive_window_ = feedback.tcp.receive_window; |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 void TcpCubicSender::OnCongestionEvent( | 88 void TcpCubicSender::OnCongestionEvent( |
89 bool rtt_updated, | 89 bool rtt_updated, |
90 QuicByteCount bytes_in_flight, | 90 QuicByteCount bytes_in_flight, |
91 const CongestionMap& acked_packets, | 91 const CongestionVector& acked_packets, |
92 const CongestionMap& lost_packets) { | 92 const CongestionVector& lost_packets) { |
93 if (rtt_updated && InSlowStart() && | 93 if (rtt_updated && InSlowStart() && |
94 hybrid_slow_start_.ShouldExitSlowStart(rtt_stats_->latest_rtt(), | 94 hybrid_slow_start_.ShouldExitSlowStart(rtt_stats_->latest_rtt(), |
95 rtt_stats_->min_rtt(), | 95 rtt_stats_->min_rtt(), |
96 congestion_window_)) { | 96 congestion_window_)) { |
97 slowstart_threshold_ = congestion_window_; | 97 slowstart_threshold_ = congestion_window_; |
98 } | 98 } |
99 for (CongestionMap::const_iterator it = lost_packets.begin(); | 99 for (CongestionVector::const_iterator it = lost_packets.begin(); |
100 it != lost_packets.end(); ++it) { | 100 it != lost_packets.end(); ++it) { |
101 OnPacketLost(it->first, bytes_in_flight); | 101 OnPacketLost(it->first, bytes_in_flight); |
102 } | 102 } |
103 for (CongestionMap::const_iterator it = acked_packets.begin(); | 103 for (CongestionVector::const_iterator it = acked_packets.begin(); |
104 it != acked_packets.end(); ++it) { | 104 it != acked_packets.end(); ++it) { |
105 OnPacketAcked(it->first, it->second.bytes_sent, bytes_in_flight); | 105 OnPacketAcked(it->first, it->second.bytes_sent, bytes_in_flight); |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 void TcpCubicSender::OnPacketAcked( | 109 void TcpCubicSender::OnPacketAcked( |
110 QuicPacketSequenceNumber acked_sequence_number, | 110 QuicPacketSequenceNumber acked_sequence_number, |
111 QuicByteCount acked_bytes, | 111 QuicByteCount acked_bytes, |
112 QuicByteCount bytes_in_flight) { | 112 QuicByteCount bytes_in_flight) { |
113 largest_acked_sequence_number_ = max(acked_sequence_number, | 113 largest_acked_sequence_number_ = max(acked_sequence_number, |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 return QuicTime::Delta::Zero(); | 354 return QuicTime::Delta::Zero(); |
355 } | 355 } |
356 return QuicTime::Delta::Infinite(); | 356 return QuicTime::Delta::Infinite(); |
357 } | 357 } |
358 | 358 |
359 CongestionControlType TcpCubicSender::GetCongestionControlType() const { | 359 CongestionControlType TcpCubicSender::GetCongestionControlType() const { |
360 return reno_ ? kReno : kCubic; | 360 return reno_ ? kReno : kCubic; |
361 } | 361 } |
362 | 362 |
363 } // namespace net | 363 } // namespace net |
OLD | NEW |