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 | 5 |
6 #include "net/quic/congestion_control/quic_send_scheduler.h" | 6 #include "net/quic/congestion_control/quic_send_scheduler.h" |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <cmath> | 9 #include <cmath> |
10 #include <map> | 10 #include <map> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 QuicTime last_timestamp(QuicTime::FromMicroseconds(0)); | 90 QuicTime last_timestamp(QuicTime::FromMicroseconds(0)); |
91 map<QuicPacketSequenceNumber, size_t> acked_packets; | 91 map<QuicPacketSequenceNumber, size_t> acked_packets; |
92 | 92 |
93 PendingPacketsMap::iterator it, it_upper; | 93 PendingPacketsMap::iterator it, it_upper; |
94 it = pending_packets_.begin(); | 94 it = pending_packets_.begin(); |
95 it_upper = pending_packets_.upper_bound( | 95 it_upper = pending_packets_.upper_bound( |
96 ack_frame.received_info.largest_received); | 96 ack_frame.received_info.largest_received); |
97 | 97 |
98 while (it != it_upper) { | 98 while (it != it_upper) { |
99 QuicPacketSequenceNumber sequence_number = it->first; | 99 QuicPacketSequenceNumber sequence_number = it->first; |
100 if (ack_frame.received_info.ContainsAck(sequence_number)) { | 100 if (ack_frame.received_info.missing_packets.find(sequence_number) == |
| 101 ack_frame.received_info.missing_packets.end()) { |
101 // Not missing, hence implicitly acked. | 102 // Not missing, hence implicitly acked. |
102 scoped_ptr<PendingPacket> pending_packet_cleaner(it->second); | 103 scoped_ptr<PendingPacket> pending_packet_cleaner(it->second); |
103 acked_packets[sequence_number] = pending_packet_cleaner->BytesSent(); | 104 acked_packets[sequence_number] = pending_packet_cleaner->BytesSent(); |
104 last_timestamp = pending_packet_cleaner->SendTimestamp(); | 105 last_timestamp = pending_packet_cleaner->SendTimestamp(); |
105 pending_packets_.erase(it++); // Must be incremented post to work. | 106 pending_packets_.erase(it++); // Must be incremented post to work. |
106 } else { | 107 } else { |
107 ++it; | 108 ++it; |
108 } | 109 } |
109 } | 110 } |
110 // We calculate the RTT based on the highest ACKed sequence number, the lower | 111 // We calculate the RTT based on the highest ACKed sequence number, the lower |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 178 |
178 int QuicSendScheduler::PeakSustainedBandwidth() { | 179 int QuicSendScheduler::PeakSustainedBandwidth() { |
179 // To make sure that we get the latest estimate we call SentBandwidth. | 180 // To make sure that we get the latest estimate we call SentBandwidth. |
180 if (HasSentPacket()) { | 181 if (HasSentPacket()) { |
181 SentBandwidth(); | 182 SentBandwidth(); |
182 } | 183 } |
183 return max_estimated_bandwidth_; | 184 return max_estimated_bandwidth_; |
184 } | 185 } |
185 | 186 |
186 } // namespace net | 187 } // namespace net |
OLD | NEW |