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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 for (vector<Transfer>::iterator it = pending_transfers_.begin(); | 141 for (vector<Transfer>::iterator it = pending_transfers_.begin(); |
142 it != pending_transfers_.end(); ++it) { | 142 it != pending_transfers_.end(); ++it) { |
143 // If we've already sent enough bytes, wait for them to be acked. | 143 // If we've already sent enough bytes, wait for them to be acked. |
144 if (it->bytes_acked + it->bytes_in_flight >= it->num_bytes) { | 144 if (it->bytes_acked + it->bytes_in_flight >= it->num_bytes) { |
145 continue; | 145 continue; |
146 } | 146 } |
147 // If the flow hasn't started, use the start time. | 147 // If the flow hasn't started, use the start time. |
148 QuicTime::Delta transfer_send_time = it->start_time.Subtract(clock_->Now()); | 148 QuicTime::Delta transfer_send_time = it->start_time.Subtract(clock_->Now()); |
149 if (clock_->Now() >= it->start_time) { | 149 if (clock_->Now() >= it->start_time) { |
150 transfer_send_time = it->sender->send_algorithm->TimeUntilSend( | 150 transfer_send_time = it->sender->send_algorithm->TimeUntilSend( |
151 clock_->Now(), it->bytes_in_flight, HAS_RETRANSMITTABLE_DATA); | 151 clock_->Now(), it->bytes_in_flight); |
152 } | 152 } |
153 if (transfer_send_time < next_send_time) { | 153 if (transfer_send_time < next_send_time) { |
154 next_send_time = transfer_send_time; | 154 next_send_time = transfer_send_time; |
155 transfer = &(*it); | 155 transfer = &(*it); |
156 } | 156 } |
157 } | 157 } |
158 DVLOG(1) << "NextSendTime returning delta(ms):" | 158 DVLOG(1) << "NextSendTime returning delta(ms):" |
159 << next_send_time.ToMilliseconds() << ", transfer '" | 159 << next_send_time.ToMilliseconds() << ", transfer '" |
160 << transfer->name; | 160 << transfer->name; |
161 return PacketEvent(next_send_time, transfer); | 161 return PacketEvent(next_send_time, transfer); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 sent_packets_.push_back(SentPacket(sender->last_sent, clock_->Now(), | 385 sent_packets_.push_back(SentPacket(sender->last_sent, clock_->Now(), |
386 ack_time, packet_lost, transfer)); | 386 ack_time, packet_lost, transfer)); |
387 } else { | 387 } else { |
388 DVLOG(1) << "losing packet:" << sender->last_sent | 388 DVLOG(1) << "losing packet:" << sender->last_sent |
389 << " name:" << transfer->name << " because the buffer was full."; | 389 << " name:" << transfer->name << " because the buffer was full."; |
390 } | 390 } |
391 transfer->bytes_in_flight += kPacketSize; | 391 transfer->bytes_in_flight += kPacketSize; |
392 } | 392 } |
393 | 393 |
394 } // namespace net | 394 } // namespace net |
OLD | NEW |