OLD | NEW |
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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "net/quic/crypto/crypto_protocol.h" | 10 #include "net/quic/crypto/crypto_protocol.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // Send retransmission. | 39 // Send retransmission. |
40 prr.OnPacketSent(kMaxSegmentSize); | 40 prr.OnPacketSent(kMaxSegmentSize); |
41 // PRR shouldn't allow sending any more packets. | 41 // PRR shouldn't allow sending any more packets. |
42 EXPECT_EQ(QuicTime::Delta::Infinite(), | 42 EXPECT_EQ(QuicTime::Delta::Infinite(), |
43 prr.TimeUntilSend(congestion_window, bytes_in_flight, | 43 prr.TimeUntilSend(congestion_window, bytes_in_flight, |
44 ssthresh_after_loss * kMaxSegmentSize)); | 44 ssthresh_after_loss * kMaxSegmentSize)); |
45 | 45 |
46 // One packet is lost, and one ack was consumed above. PRR now paces | 46 // One packet is lost, and one ack was consumed above. PRR now paces |
47 // transmissions through the remaining 48 acks. PRR will alternatively | 47 // transmissions through the remaining 48 acks. PRR will alternatively |
48 // disallow and allow a packet to be sent in response to an ack. | 48 // disallow and allow a packet to be sent in response to an ack. |
49 for (uint64 i = 0; i < ssthresh_after_loss - 1; ++i) { | 49 for (uint64_t i = 0; i < ssthresh_after_loss - 1; ++i) { |
50 // Ack a packet. PRR shouldn't allow sending a packet in response. | 50 // Ack a packet. PRR shouldn't allow sending a packet in response. |
51 prr.OnPacketAcked(kMaxSegmentSize); | 51 prr.OnPacketAcked(kMaxSegmentSize); |
52 bytes_in_flight -= kMaxSegmentSize; | 52 bytes_in_flight -= kMaxSegmentSize; |
53 EXPECT_EQ(QuicTime::Delta::Infinite(), | 53 EXPECT_EQ(QuicTime::Delta::Infinite(), |
54 prr.TimeUntilSend(congestion_window, bytes_in_flight, | 54 prr.TimeUntilSend(congestion_window, bytes_in_flight, |
55 ssthresh_after_loss * kMaxSegmentSize)); | 55 ssthresh_after_loss * kMaxSegmentSize)); |
56 // Ack another packet. PRR should now allow sending a packet in response. | 56 // Ack another packet. PRR should now allow sending a packet in response. |
57 prr.OnPacketAcked(kMaxSegmentSize); | 57 prr.OnPacketAcked(kMaxSegmentSize); |
58 bytes_in_flight -= kMaxSegmentSize; | 58 bytes_in_flight -= kMaxSegmentSize; |
59 EXPECT_EQ(QuicTime::Delta::Zero(), | 59 EXPECT_EQ(QuicTime::Delta::Zero(), |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 prr.TimeUntilSend(congestion_window, bytes_in_flight, | 125 prr.TimeUntilSend(congestion_window, bytes_in_flight, |
126 ssthresh_after_loss * kMaxSegmentSize)); | 126 ssthresh_after_loss * kMaxSegmentSize)); |
127 // Send a packet in response. | 127 // Send a packet in response. |
128 prr.OnPacketSent(kMaxSegmentSize); | 128 prr.OnPacketSent(kMaxSegmentSize); |
129 bytes_in_flight += kMaxSegmentSize; | 129 bytes_in_flight += kMaxSegmentSize; |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
133 } // namespace test | 133 } // namespace test |
134 } // namespace net | 134 } // namespace net |
OLD | NEW |