Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: net/quic/congestion_control/prr_sender.cc

Issue 972033002: Change QUIC's PrrSender::TimeUntilSend to accept bytes instead of packets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Discard_acks_87419283
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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/prr_sender.h" 5 #include "net/quic/congestion_control/prr_sender.h"
6 6
7 #include "net/quic/quic_protocol.h" 7 #include "net/quic/quic_protocol.h"
8 8
9 namespace net { 9 namespace net {
10 10
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 void PrrSender::OnPacketAcked(QuicByteCount acked_bytes) { 34 void PrrSender::OnPacketAcked(QuicByteCount acked_bytes) {
35 bytes_delivered_since_loss_ += acked_bytes; 35 bytes_delivered_since_loss_ += acked_bytes;
36 ++ack_count_since_loss_; 36 ++ack_count_since_loss_;
37 } 37 }
38 38
39 QuicTime::Delta PrrSender::TimeUntilSend( 39 QuicTime::Delta PrrSender::TimeUntilSend(
40 QuicByteCount congestion_window, 40 QuicByteCount congestion_window,
41 QuicByteCount bytes_in_flight, 41 QuicByteCount bytes_in_flight,
42 QuicPacketCount slowstart_threshold) const { 42 QuicByteCount slowstart_threshold) const {
43 // Return QuicTime::Zero In order to ensure limited transmit always works. 43 // Return QuicTime::Zero In order to ensure limited transmit always works.
44 if (bytes_sent_since_loss_ == 0 || bytes_in_flight < kMaxSegmentSize) { 44 if (bytes_sent_since_loss_ == 0 || bytes_in_flight < kMaxSegmentSize) {
45 return QuicTime::Delta::Zero(); 45 return QuicTime::Delta::Zero();
46 } 46 }
47 if (congestion_window > bytes_in_flight) { 47 if (congestion_window > bytes_in_flight) {
48 // During PRR-SSRB, limit outgoing packets to 1 extra MSS per ack, instead 48 // During PRR-SSRB, limit outgoing packets to 1 extra MSS per ack, instead
49 // of sending the entire available window. This prevents burst retransmits 49 // of sending the entire available window. This prevents burst retransmits
50 // when more packets are lost than the CWND reduction. 50 // when more packets are lost than the CWND reduction.
51 // limit = MAX(prr_delivered - prr_out, DeliveredData) + MSS 51 // limit = MAX(prr_delivered - prr_out, DeliveredData) + MSS
52 if (bytes_delivered_since_loss_ + ack_count_since_loss_ * kMaxSegmentSize <= 52 if (bytes_delivered_since_loss_ + ack_count_since_loss_ * kMaxSegmentSize <=
53 bytes_sent_since_loss_) { 53 bytes_sent_since_loss_) {
54 return QuicTime::Delta::Infinite(); 54 return QuicTime::Delta::Infinite();
55 } 55 }
56 return QuicTime::Delta::Zero(); 56 return QuicTime::Delta::Zero();
57 } 57 }
58 // Implement Proportional Rate Reduction (RFC6937). 58 // Implement Proportional Rate Reduction (RFC6937).
59 // Checks a simplified version of the PRR formula that doesn't use division: 59 // Checks a simplified version of the PRR formula that doesn't use division:
60 // AvailableSendWindow = 60 // AvailableSendWindow =
61 // CEIL(prr_delivered * ssthresh / BytesInFlightAtLoss) - prr_sent 61 // CEIL(prr_delivered * ssthresh / BytesInFlightAtLoss) - prr_sent
62 if (bytes_delivered_since_loss_ * slowstart_threshold * kMaxSegmentSize > 62 if (bytes_delivered_since_loss_ * slowstart_threshold >
63 bytes_sent_since_loss_ * bytes_in_flight_before_loss_) { 63 bytes_sent_since_loss_ * bytes_in_flight_before_loss_) {
64 return QuicTime::Delta::Zero(); 64 return QuicTime::Delta::Zero();
65 } 65 }
66 return QuicTime::Delta::Infinite(); 66 return QuicTime::Delta::Infinite();
67 } 67 }
68 68
69 } // namespace net 69 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/prr_sender.h ('k') | net/quic/congestion_control/prr_sender_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698