OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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/send_algorithm_simulator.h" | 5 #include "net/quic/congestion_control/send_algorithm_simulator.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
11 #include "net/quic/crypto/quic_random.h" | 11 #include "net/quic/crypto/quic_random.h" |
12 | 12 |
13 using std::list; | 13 using std::list; |
14 using std::make_pair; | |
15 using std::max; | 14 using std::max; |
16 using std::min; | 15 using std::min; |
17 using std::string; | 16 using std::string; |
18 using std::vector; | 17 using std::vector; |
19 | 18 |
20 namespace net { | 19 namespace net { |
21 | 20 |
22 namespace { | 21 namespace { |
23 | 22 |
24 const QuicByteCount kPacketSize = 1200; | 23 const QuicByteCount kPacketSize = 1200; |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 info.in_flight = true; | 282 info.in_flight = true; |
284 // Find the next SentPacket for this transfer. | 283 // Find the next SentPacket for this transfer. |
285 while (it->transfer != transfer) { | 284 while (it->transfer != transfer) { |
286 DCHECK(it != sent_packets_.end()); | 285 DCHECK(it != sent_packets_.end()); |
287 ++it; | 286 ++it; |
288 } | 287 } |
289 // If it's missing from the array, it's a loss. | 288 // If it's missing from the array, it's a loss. |
290 if (it->sequence_number > sender->last_acked) { | 289 if (it->sequence_number > sender->last_acked) { |
291 DVLOG(1) << "Lost packet:" << sender->last_acked | 290 DVLOG(1) << "Lost packet:" << sender->last_acked |
292 << " dropped by buffer overflow."; | 291 << " dropped by buffer overflow."; |
293 lost_packets.push_back(make_pair(sender->last_acked, info)); | 292 lost_packets.push_back(std::make_pair(sender->last_acked, info)); |
294 continue; | 293 continue; |
295 } | 294 } |
296 if (it->lost) { | 295 if (it->lost) { |
297 lost_packets.push_back(make_pair(sender->last_acked, info)); | 296 lost_packets.push_back(std::make_pair(sender->last_acked, info)); |
298 } else { | 297 } else { |
299 acked_packets.push_back(make_pair(sender->last_acked, info)); | 298 acked_packets.push_back(std::make_pair(sender->last_acked, info)); |
300 } | 299 } |
301 // This packet has been acked or lost, remove it from sent_packets_. | 300 // This packet has been acked or lost, remove it from sent_packets_. |
302 largest_observed = *it; | 301 largest_observed = *it; |
303 sent_packets_.erase(it++); | 302 sent_packets_.erase(it++); |
304 } | 303 } |
305 | 304 |
306 DCHECK(!largest_observed.lost); | 305 DCHECK(!largest_observed.lost); |
307 DVLOG(1) << "Updating RTT from send_time:" | 306 DVLOG(1) << "Updating RTT from send_time:" |
308 << largest_observed.send_time.ToDebuggingValue() << " to ack_time:" | 307 << largest_observed.send_time.ToDebuggingValue() << " to ack_time:" |
309 << largest_observed.ack_time.ToDebuggingValue(); | 308 << largest_observed.ack_time.ToDebuggingValue(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 } | 386 } |
388 transfer->bytes_in_flight += kPacketSize; | 387 transfer->bytes_in_flight += kPacketSize; |
389 } | 388 } |
390 | 389 |
391 // Advance the time by |delta| without sending anything. | 390 // Advance the time by |delta| without sending anything. |
392 void SendAlgorithmSimulator::AdvanceTime(QuicTime::Delta delta) { | 391 void SendAlgorithmSimulator::AdvanceTime(QuicTime::Delta delta) { |
393 clock_->AdvanceTime(delta); | 392 clock_->AdvanceTime(delta); |
394 } | 393 } |
395 | 394 |
396 } // namespace net | 395 } // namespace net |
OLD | NEW |