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.missing_packets.find(sequence_number) == | 100 if (ack_frame.received_info.ContainsAck(sequence_number)) { |
101 ack_frame.received_info.missing_packets.end()) { | |
102 // Not missing, hence implicitly acked. | 101 // Not missing, hence implicitly acked. |
103 scoped_ptr<PendingPacket> pending_packet_cleaner(it->second); | 102 scoped_ptr<PendingPacket> pending_packet_cleaner(it->second); |
104 acked_packets[sequence_number] = pending_packet_cleaner->BytesSent(); | 103 acked_packets[sequence_number] = pending_packet_cleaner->BytesSent(); |
105 last_timestamp = pending_packet_cleaner->SendTimestamp(); | 104 last_timestamp = pending_packet_cleaner->SendTimestamp(); |
106 pending_packets_.erase(it++); // Must be incremented post to work. | 105 pending_packets_.erase(it++); // Must be incremented post to work. |
107 } else { | 106 } else { |
108 ++it; | 107 ++it; |
109 } | 108 } |
110 } | 109 } |
111 // We calculate the RTT based on the highest ACKed sequence number, the lower | 110 // 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... |
178 | 177 |
179 int QuicSendScheduler::PeakSustainedBandwidth() { | 178 int QuicSendScheduler::PeakSustainedBandwidth() { |
180 // To make sure that we get the latest estimate we call SentBandwidth. | 179 // To make sure that we get the latest estimate we call SentBandwidth. |
181 if (HasSentPacket()) { | 180 if (HasSentPacket()) { |
182 SentBandwidth(); | 181 SentBandwidth(); |
183 } | 182 } |
184 return max_estimated_bandwidth_; | 183 return max_estimated_bandwidth_; |
185 } | 184 } |
186 | 185 |
187 } // namespace net | 186 } // namespace net |
OLD | NEW |