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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "net/quic/congestion_control/pacing_sender.h" | 9 #include "net/quic/congestion_control/pacing_sender.h" |
10 #include "net/quic/quic_ack_notifier_manager.h" | 10 #include "net/quic/quic_ack_notifier_manager.h" |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 ++it; | 869 ++it; |
870 } | 870 } |
871 DCHECK(it != unacked_packets_.end()); | 871 DCHECK(it != unacked_packets_.end()); |
872 const QuicTime& sent_time = it->second.sent_time; | 872 const QuicTime& sent_time = it->second.sent_time; |
873 // Always wait at least 1.5 * RTT after the first sent packet. | 873 // Always wait at least 1.5 * RTT after the first sent packet. |
874 QuicTime min_timeout = clock_->ApproximateNow().Add( | 874 QuicTime min_timeout = clock_->ApproximateNow().Add( |
875 SmoothedRtt().Multiply(1.5)); | 875 SmoothedRtt().Multiply(1.5)); |
876 QuicTime rto_timeout = sent_time.Add(GetRetransmissionDelay()); | 876 QuicTime rto_timeout = sent_time.Add(GetRetransmissionDelay()); |
877 return QuicTime::Max(min_timeout, rto_timeout); | 877 return QuicTime::Max(min_timeout, rto_timeout); |
878 } | 878 } |
879 default: | |
880 DCHECK(false); | |
881 } | 879 } |
| 880 DCHECK(false); |
882 return QuicTime::Zero(); | 881 return QuicTime::Zero(); |
883 } | 882 } |
884 | 883 |
885 const QuicTime::Delta QuicSentPacketManager::GetCryptoRetransmissionDelay() | 884 const QuicTime::Delta QuicSentPacketManager::GetCryptoRetransmissionDelay() |
886 const { | 885 const { |
887 // This is equivalent to the TailLossProbeDelay, but slightly more aggressive | 886 // This is equivalent to the TailLossProbeDelay, but slightly more aggressive |
888 // because crypto handshake messages don't incur a delayed ack time. | 887 // because crypto handshake messages don't incur a delayed ack time. |
889 int64 delay_ms = max<int64>(kMinHandshakeTimeoutMs, | 888 int64 delay_ms = max<int64>(kMinHandshakeTimeoutMs, |
890 1.5 * SmoothedRtt().ToMilliseconds()); | 889 1.5 * SmoothedRtt().ToMilliseconds()); |
891 return QuicTime::Delta::FromMilliseconds( | 890 return QuicTime::Delta::FromMilliseconds( |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 } | 991 } |
993 previous_transmissions->erase(sequence_number); | 992 previous_transmissions->erase(sequence_number); |
994 if (previous_transmissions->size() == 1) { | 993 if (previous_transmissions->size() == 1) { |
995 QuicPacketSequenceNumber current = *previous_transmissions->begin(); | 994 QuicPacketSequenceNumber current = *previous_transmissions->begin(); |
996 unacked_packets_[current].previous_transmissions = NULL; | 995 unacked_packets_[current].previous_transmissions = NULL; |
997 delete previous_transmissions; | 996 delete previous_transmissions; |
998 } | 997 } |
999 } | 998 } |
1000 | 999 |
1001 } // namespace net | 1000 } // namespace net |
OLD | NEW |