| 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 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Only exponentially back off the handshake timer 5 times due to a timeout. | 32 // Only exponentially back off the handshake timer 5 times due to a timeout. |
| 33 static const size_t kMaxHandshakeRetransmissionBackoffs = 5; | 33 static const size_t kMaxHandshakeRetransmissionBackoffs = 5; |
| 34 static const size_t kMinHandshakeTimeoutMs = 10; | 34 static const size_t kMinHandshakeTimeoutMs = 10; |
| 35 | 35 |
| 36 // Sends up to two tail loss probes before firing an RTO, | 36 // Sends up to two tail loss probes before firing an RTO, |
| 37 // per draft RFC draft-dukkipati-tcpm-tcp-loss-probe. | 37 // per draft RFC draft-dukkipati-tcpm-tcp-loss-probe. |
| 38 static const size_t kDefaultMaxTailLossProbes = 2; | 38 static const size_t kDefaultMaxTailLossProbes = 2; |
| 39 static const int64 kMinTailLossProbeTimeoutMs = 10; | 39 static const int64 kMinTailLossProbeTimeoutMs = 10; |
| 40 | 40 |
| 41 // Number of samples before we force a new recent min rtt to be captured. |
| 42 static const size_t kNumMinRttSamplesAfterQuiescence = 2; |
| 43 |
| 41 bool HasCryptoHandshake(const TransmissionInfo& transmission_info) { | 44 bool HasCryptoHandshake(const TransmissionInfo& transmission_info) { |
| 42 if (transmission_info.retransmittable_frames == NULL) { | 45 if (transmission_info.retransmittable_frames == NULL) { |
| 43 return false; | 46 return false; |
| 44 } | 47 } |
| 45 return transmission_info.retransmittable_frames->HasCryptoHandshake() == | 48 return transmission_info.retransmittable_frames->HasCryptoHandshake() == |
| 46 IS_HANDSHAKE; | 49 IS_HANDSHAKE; |
| 47 } | 50 } |
| 48 | 51 |
| 49 } // namespace | 52 } // namespace |
| 50 | 53 |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 TransmissionType transmission_type, | 440 TransmissionType transmission_type, |
| 438 HasRetransmittableData has_retransmittable_data) { | 441 HasRetransmittableData has_retransmittable_data) { |
| 439 DCHECK_LT(0u, sequence_number); | 442 DCHECK_LT(0u, sequence_number); |
| 440 LOG_IF(DFATAL, bytes == 0) << "Cannot send empty packets."; | 443 LOG_IF(DFATAL, bytes == 0) << "Cannot send empty packets."; |
| 441 // In rare circumstances, the packet could be serialized, sent, and then acked | 444 // In rare circumstances, the packet could be serialized, sent, and then acked |
| 442 // before OnPacketSent is called. | 445 // before OnPacketSent is called. |
| 443 if (!unacked_packets_.IsUnacked(sequence_number)) { | 446 if (!unacked_packets_.IsUnacked(sequence_number)) { |
| 444 return false; | 447 return false; |
| 445 } | 448 } |
| 446 | 449 |
| 450 if (unacked_packets_.bytes_in_flight() == 0) { |
| 451 // TODO(ianswett): Consider being less aggressive to force a new |
| 452 // recent_min_rtt, likely by not discarding a relatively new sample. |
| 453 DVLOG(1) << "Sampling a new recent min rtt within 2 samples. currently:" |
| 454 << rtt_stats_.recent_min_rtt().ToMilliseconds() << "ms"; |
| 455 rtt_stats_.SampleNewRecentMinRtt(kNumMinRttSamplesAfterQuiescence); |
| 456 } |
| 457 |
| 447 // Only track packets as pending that the send algorithm wants us to track. | 458 // Only track packets as pending that the send algorithm wants us to track. |
| 448 const bool pending = | 459 const bool pending = |
| 449 send_algorithm_->OnPacketSent(sent_time, | 460 send_algorithm_->OnPacketSent(sent_time, |
| 450 unacked_packets_.bytes_in_flight(), | 461 unacked_packets_.bytes_in_flight(), |
| 451 sequence_number, | 462 sequence_number, |
| 452 bytes, | 463 bytes, |
| 453 has_retransmittable_data); | 464 has_retransmittable_data); |
| 454 unacked_packets_.SetSent(sequence_number, sent_time, bytes, pending); | 465 unacked_packets_.SetSent(sequence_number, sent_time, bytes, pending); |
| 455 | 466 |
| 456 // Reset the retransmission timer anytime a pending packet is sent. | 467 // Reset the retransmission timer anytime a pending packet is sent. |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 return; | 774 return; |
| 764 } | 775 } |
| 765 | 776 |
| 766 using_pacing_ = true; | 777 using_pacing_ = true; |
| 767 send_algorithm_.reset( | 778 send_algorithm_.reset( |
| 768 new PacingSender(send_algorithm_.release(), | 779 new PacingSender(send_algorithm_.release(), |
| 769 QuicTime::Delta::FromMicroseconds(1))); | 780 QuicTime::Delta::FromMicroseconds(1))); |
| 770 } | 781 } |
| 771 | 782 |
| 772 } // namespace net | 783 } // namespace net |
| OLD | NEW |