| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/quic_sent_packet_manager.h" | 5 #include "net/quic/quic_sent_packet_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 QuicSentPacketManager::PendingRetransmission | 428 QuicSentPacketManager::PendingRetransmission |
| 429 QuicSentPacketManager::NextPendingRetransmission() { | 429 QuicSentPacketManager::NextPendingRetransmission() { |
| 430 LOG_IF(DFATAL, pending_retransmissions_.empty()) | 430 LOG_IF(DFATAL, pending_retransmissions_.empty()) |
| 431 << "Unexpected call to PendingRetransmissions() with empty pending " | 431 << "Unexpected call to PendingRetransmissions() with empty pending " |
| 432 << "retransmission list. Corrupted memory usage imminent."; | 432 << "retransmission list. Corrupted memory usage imminent."; |
| 433 QuicPacketSequenceNumber sequence_number = | 433 QuicPacketSequenceNumber sequence_number = |
| 434 pending_retransmissions_.begin()->first; | 434 pending_retransmissions_.begin()->first; |
| 435 TransmissionType transmission_type = pending_retransmissions_.begin()->second; | 435 TransmissionType transmission_type = pending_retransmissions_.begin()->second; |
| 436 if (unacked_packets_.HasPendingCryptoPackets()) { | 436 if (unacked_packets_.HasPendingCryptoPackets()) { |
| 437 // Ensure crypto packets are retransmitted before other packets. | 437 // Ensure crypto packets are retransmitted before other packets. |
| 438 PendingRetransmissionMap::const_iterator it = | 438 for (const auto& pair : pending_retransmissions_) { |
| 439 pending_retransmissions_.begin(); | 439 if (HasCryptoHandshake( |
| 440 do { | 440 unacked_packets_.GetTransmissionInfo(pair.first))) { |
| 441 if (HasCryptoHandshake(unacked_packets_.GetTransmissionInfo(it->first))) { | 441 sequence_number = pair.first; |
| 442 sequence_number = it->first; | 442 transmission_type = pair.second; |
| 443 transmission_type = it->second; | |
| 444 break; | 443 break; |
| 445 } | 444 } |
| 446 ++it; | 445 } |
| 447 } while (it != pending_retransmissions_.end()); | |
| 448 } | 446 } |
| 449 DCHECK(unacked_packets_.IsUnacked(sequence_number)) << sequence_number; | 447 DCHECK(unacked_packets_.IsUnacked(sequence_number)) << sequence_number; |
| 450 const TransmissionInfo& transmission_info = | 448 const TransmissionInfo& transmission_info = |
| 451 unacked_packets_.GetTransmissionInfo(sequence_number); | 449 unacked_packets_.GetTransmissionInfo(sequence_number); |
| 452 DCHECK(transmission_info.retransmittable_frames); | 450 DCHECK(transmission_info.retransmittable_frames); |
| 453 | 451 |
| 454 return PendingRetransmission(sequence_number, | 452 return PendingRetransmission(sequence_number, |
| 455 transmission_type, | 453 transmission_type, |
| 456 *transmission_info.retransmittable_frames, | 454 *transmission_info.retransmittable_frames, |
| 457 transmission_info.sequence_number_length); | 455 transmission_info.sequence_number_length); |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as | 942 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as |
| 945 // the default granularity of the Linux kernel's FQ qdisc. | 943 // the default granularity of the Linux kernel's FQ qdisc. |
| 946 using_pacing_ = true; | 944 using_pacing_ = true; |
| 947 send_algorithm_.reset( | 945 send_algorithm_.reset( |
| 948 new PacingSender(send_algorithm_.release(), | 946 new PacingSender(send_algorithm_.release(), |
| 949 QuicTime::Delta::FromMilliseconds(1), | 947 QuicTime::Delta::FromMilliseconds(1), |
| 950 kInitialUnpacedBurst)); | 948 kInitialUnpacedBurst)); |
| 951 } | 949 } |
| 952 | 950 |
| 953 } // namespace net | 951 } // namespace net |
| OLD | NEW |