| 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/core/quic_sent_packet_manager.h" | 5 #include "net/quic/core/quic_sent_packet_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/stl_util.h" | |
| 11 #include "net/quic/chromium/quic_utils_chromium.h" | 10 #include "net/quic/chromium/quic_utils_chromium.h" |
| 12 #include "net/quic/core/congestion_control/general_loss_algorithm.h" | 11 #include "net/quic/core/congestion_control/general_loss_algorithm.h" |
| 13 #include "net/quic/core/congestion_control/pacing_sender.h" | 12 #include "net/quic/core/congestion_control/pacing_sender.h" |
| 14 #include "net/quic/core/crypto/crypto_protocol.h" | 13 #include "net/quic/core/crypto/crypto_protocol.h" |
| 15 #include "net/quic/core/proto/cached_network_parameters.pb.h" | 14 #include "net/quic/core/proto/cached_network_parameters.pb.h" |
| 16 #include "net/quic/core/quic_connection_stats.h" | 15 #include "net/quic/core/quic_connection_stats.h" |
| 17 #include "net/quic/core/quic_flags.h" | 16 #include "net/quic/core/quic_flags.h" |
| 18 #include "net/quic/core/quic_pending_retransmission.h" | 17 #include "net/quic/core/quic_pending_retransmission.h" |
| 19 #include "net/quic/platform/api/quic_bug_tracker.h" | 18 #include "net/quic/platform/api/quic_bug_tracker.h" |
| 20 #include "net/quic/platform/api/quic_logging.h" | 19 #include "net/quic/platform/api/quic_logging.h" |
| 20 #include "net/quic/platform/api/quic_map_util.h" |
| 21 | 21 |
| 22 namespace net { | 22 namespace net { |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 static const int64_t kDefaultRetransmissionTimeMs = 500; | 25 static const int64_t kDefaultRetransmissionTimeMs = 500; |
| 26 static const int64_t kMaxRetransmissionTimeMs = 60000; | 26 static const int64_t kMaxRetransmissionTimeMs = 60000; |
| 27 // Maximum number of exponential backoffs used for RTO timeouts. | 27 // Maximum number of exponential backoffs used for RTO timeouts. |
| 28 static const size_t kMaxRetransmissions = 10; | 28 static const size_t kMaxRetransmissions = 10; |
| 29 // Maximum number of packets retransmitted upon an RTO. | 29 // Maximum number of packets retransmitted upon an RTO. |
| 30 static const size_t kMaxRetransmissionsOnTimeout = 2; | 30 static const size_t kMaxRetransmissionsOnTimeout = 2; |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 unacked_packets_.GetTransmissionInfo(packet_number); | 390 unacked_packets_.GetTransmissionInfo(packet_number); |
| 391 QUIC_BUG_IF(transmission_info.retransmittable_frames.empty()); | 391 QUIC_BUG_IF(transmission_info.retransmittable_frames.empty()); |
| 392 // Both TLP and the new RTO leave the packets in flight and let the loss | 392 // Both TLP and the new RTO leave the packets in flight and let the loss |
| 393 // detection decide if packets are lost. | 393 // detection decide if packets are lost. |
| 394 if (transmission_type != TLP_RETRANSMISSION && | 394 if (transmission_type != TLP_RETRANSMISSION && |
| 395 transmission_type != RTO_RETRANSMISSION) { | 395 transmission_type != RTO_RETRANSMISSION) { |
| 396 unacked_packets_.RemoveFromInFlight(packet_number); | 396 unacked_packets_.RemoveFromInFlight(packet_number); |
| 397 } | 397 } |
| 398 // TODO(ianswett): Currently the RTO can fire while there are pending NACK | 398 // TODO(ianswett): Currently the RTO can fire while there are pending NACK |
| 399 // retransmissions for the same data, which is not ideal. | 399 // retransmissions for the same data, which is not ideal. |
| 400 if (base::ContainsKey(pending_retransmissions_, packet_number)) { | 400 if (QuicContainsKey(pending_retransmissions_, packet_number)) { |
| 401 return; | 401 return; |
| 402 } | 402 } |
| 403 | 403 |
| 404 pending_retransmissions_[packet_number] = transmission_type; | 404 pending_retransmissions_[packet_number] = transmission_type; |
| 405 } | 405 } |
| 406 | 406 |
| 407 void QuicSentPacketManager::RecordOneSpuriousRetransmission( | 407 void QuicSentPacketManager::RecordOneSpuriousRetransmission( |
| 408 const QuicTransmissionInfo& info) { | 408 const QuicTransmissionInfo& info) { |
| 409 stats_->bytes_spuriously_retransmitted += info.bytes_sent; | 409 stats_->bytes_spuriously_retransmitted += info.bytes_sent; |
| 410 ++stats_->packets_spuriously_retransmitted; | 410 ++stats_->packets_spuriously_retransmitted; |
| 411 if (debug_delegate_ != nullptr) { | 411 if (debug_delegate_ != nullptr) { |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 | 991 |
| 992 void QuicSentPacketManager::OnApplicationLimited() { | 992 void QuicSentPacketManager::OnApplicationLimited() { |
| 993 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); | 993 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); |
| 994 } | 994 } |
| 995 | 995 |
| 996 const SendAlgorithmInterface* QuicSentPacketManager::GetSendAlgorithm() const { | 996 const SendAlgorithmInterface* QuicSentPacketManager::GetSendAlgorithm() const { |
| 997 return send_algorithm_.get(); | 997 return send_algorithm_.get(); |
| 998 } | 998 } |
| 999 | 999 |
| 1000 } // namespace net | 1000 } // namespace net |
| OLD | NEW |