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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 config.ReceivedInitialCongestionWindow()); | 72 config.ReceivedInitialCongestionWindow()); |
73 } | 73 } |
74 } | 74 } |
75 if (config.HasReceivedSocketReceiveBuffer()) { | 75 if (config.HasReceivedSocketReceiveBuffer()) { |
76 // Set the initial socket receive buffer size in bytes. | 76 // Set the initial socket receive buffer size in bytes. |
77 receive_window_ = config.ReceivedSocketReceiveBuffer(); | 77 receive_window_ = config.ReceivedSocketReceiveBuffer(); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 void TcpCubicSender::SetNumEmulatedConnections(int num_connections) { | 81 void TcpCubicSender::SetNumEmulatedConnections(int num_connections) { |
82 num_connections_ = num_connections; | 82 num_connections_ = max(1, num_connections); |
83 cubic_.SetNumConnections(num_connections); | 83 cubic_.SetNumConnections(num_connections_); |
84 } | 84 } |
85 | 85 |
86 void TcpCubicSender::OnIncomingQuicCongestionFeedbackFrame( | 86 void TcpCubicSender::OnIncomingQuicCongestionFeedbackFrame( |
87 const QuicCongestionFeedbackFrame& feedback, | 87 const QuicCongestionFeedbackFrame& feedback, |
88 QuicTime feedback_receive_time) { | 88 QuicTime feedback_receive_time) { |
89 if (feedback.type == kTCP) { | 89 if (feedback.type == kTCP) { |
90 receive_window_ = feedback.tcp.receive_window; | 90 receive_window_ = feedback.tcp.receive_window; |
91 } | 91 } |
92 } | 92 } |
93 | 93 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 return QuicTime::Delta::Zero(); | 361 return QuicTime::Delta::Zero(); |
362 } | 362 } |
363 return QuicTime::Delta::Infinite(); | 363 return QuicTime::Delta::Infinite(); |
364 } | 364 } |
365 | 365 |
366 CongestionControlType TcpCubicSender::GetCongestionControlType() const { | 366 CongestionControlType TcpCubicSender::GetCongestionControlType() const { |
367 return reno_ ? kReno : kCubic; | 367 return reno_ ? kReno : kCubic; |
368 } | 368 } |
369 | 369 |
370 } // namespace net | 370 } // namespace net |
OLD | NEW |