Index: net/quic/congestion_control/tcp_cubic_sender.cc |
diff --git a/net/quic/congestion_control/tcp_cubic_sender.cc b/net/quic/congestion_control/tcp_cubic_sender.cc |
index 14804a993f18b8479357abd600f71b825e42cb44..0a7a89743dc3b8bf992dc9c4a3ad5a044dc0c003 100644 |
--- a/net/quic/congestion_control/tcp_cubic_sender.cc |
+++ b/net/quic/congestion_control/tcp_cubic_sender.cc |
@@ -12,6 +12,8 @@ namespace net { |
namespace { |
// Constants based on TCP defaults. |
+//TODO(rch): set to 2. |
+const QuicTcpCongestionWindow kMinimumCongestionWindow = 1; |
const int64 kHybridStartLowWindow = 16; |
const QuicByteCount kMaxSegmentSize = kDefaultTCPMSS; |
const QuicByteCount kDefaultReceiveWindow = 64000; |
@@ -94,7 +96,7 @@ void TcpCubicSender::OnIncomingLoss(QuicTime /*ack_receive_time*/) { |
} |
// Sanity, make sure that we don't end up with an empty window. |
if (congestion_window_ == 0) { |
- congestion_window_ = 1; |
+ congestion_window_ = kMinimumCongestionWindow; |
} |
DLOG(INFO) << "Incoming loss; congestion window:" << congestion_window_; |
} |
@@ -155,8 +157,7 @@ QuicByteCount TcpCubicSender::AvailableSendWindow() { |
QuicByteCount TcpCubicSender::SendWindow() { |
// What's the current send window in bytes. |
- return std::min(receive_window_, |
- congestion_window_ * kMaxSegmentSize); |
+ return std::min(receive_window_, GetCongestionWindow()); |
} |
QuicBandwidth TcpCubicSender::BandwidthEstimate() { |
@@ -178,6 +179,17 @@ QuicTime::Delta TcpCubicSender::RetransmissionDelay() { |
smoothed_rtt_.ToMicroseconds() + 4 * mean_deviation_.ToMicroseconds()); |
} |
+QuicByteCount TcpCubicSender::GetCongestionWindow() { |
+ return congestion_window_ * kMaxSegmentSize; |
+} |
+ |
+void TcpCubicSender::SetCongestionWindow(QuicByteCount window) { |
+ congestion_window_ = window / kMaxSegmentSize; |
+ if (congestion_window_ < kMinimumCongestionWindow) { |
+ congestion_window_ = kMinimumCongestionWindow; |
+ } |
+} |
+ |
void TcpCubicSender::Reset() { |
delay_min_ = QuicTime::Delta::Zero(); |
hybrid_slow_start_.Restart(); |