Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: net/quic/core/quic_sent_packet_manager.cc

Issue 2611613003: Add quic_logging (Closed)
Patch Set: fix failed test? Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_received_packet_manager.cc ('k') | net/quic/core/quic_server_id.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/logging.h"
11 #include "base/stl_util.h" 10 #include "base/stl_util.h"
12 #include "net/quic/chromium/quic_utils_chromium.h" 11 #include "net/quic/chromium/quic_utils_chromium.h"
13 #include "net/quic/core/congestion_control/general_loss_algorithm.h" 12 #include "net/quic/core/congestion_control/general_loss_algorithm.h"
14 #include "net/quic/core/congestion_control/pacing_sender.h" 13 #include "net/quic/core/congestion_control/pacing_sender.h"
15 #include "net/quic/core/crypto/crypto_protocol.h" 14 #include "net/quic/core/crypto/crypto_protocol.h"
16 #include "net/quic/core/proto/cached_network_parameters.pb.h" 15 #include "net/quic/core/proto/cached_network_parameters.pb.h"
17 #include "net/quic/core/quic_connection_stats.h" 16 #include "net/quic/core/quic_connection_stats.h"
18 #include "net/quic/core/quic_flags.h" 17 #include "net/quic/core/quic_flags.h"
19 #include "net/quic/core/quic_pending_retransmission.h" 18 #include "net/quic/core/quic_pending_retransmission.h"
20 #include "net/quic/platform/api/quic_bug_tracker.h" 19 #include "net/quic/platform/api/quic_bug_tracker.h"
20 #include "net/quic/platform/api/quic_logging.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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 if (packet_number > ack_frame.largest_observed) { 335 if (packet_number > ack_frame.largest_observed) {
336 // These packets are still in flight. 336 // These packets are still in flight.
337 break; 337 break;
338 } 338 }
339 339
340 if (!ack_frame.packets.Contains(packet_number)) { 340 if (!ack_frame.packets.Contains(packet_number)) {
341 // Packet is still missing. 341 // Packet is still missing.
342 continue; 342 continue;
343 } 343 }
344 // Packet was acked, so remove it from our unacked packet list. 344 // Packet was acked, so remove it from our unacked packet list.
345 DVLOG(1) << ENDPOINT << "Got an ack for packet " << packet_number; 345 QUIC_DVLOG(1) << ENDPOINT << "Got an ack for packet " << packet_number;
346 // If data is associated with the most recent transmission of this 346 // If data is associated with the most recent transmission of this
347 // packet, then inform the caller. 347 // packet, then inform the caller.
348 if (it->in_flight) { 348 if (it->in_flight) {
349 packets_acked_.push_back(std::make_pair(packet_number, it->bytes_sent)); 349 packets_acked_.push_back(std::make_pair(packet_number, it->bytes_sent));
350 } else if (!it->is_unackable) { 350 } else if (!it->is_unackable) {
351 // Packets are marked unackable after they've been acked once. 351 // Packets are marked unackable after they've been acked once.
352 largest_newly_acked_ = packet_number; 352 largest_newly_acked_ = packet_number;
353 } 353 }
354 MarkPacketHandled(packet_number, &(*it), ack_delay_time); 354 MarkPacketHandled(packet_number, &(*it), ack_delay_time);
355 } 355 }
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); 649 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked();
650 for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); 650 for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin();
651 it != unacked_packets_.end(); ++it, ++packet_number) { 651 it != unacked_packets_.end(); ++it, ++packet_number) {
652 // Only retransmit frames which are in flight, and therefore have been sent. 652 // Only retransmit frames which are in flight, and therefore have been sent.
653 if (!it->in_flight || it->retransmittable_frames.empty()) { 653 if (!it->in_flight || it->retransmittable_frames.empty()) {
654 continue; 654 continue;
655 } 655 }
656 MarkForRetransmission(packet_number, TLP_RETRANSMISSION); 656 MarkForRetransmission(packet_number, TLP_RETRANSMISSION);
657 return true; 657 return true;
658 } 658 }
659 DLOG(ERROR) 659 QUIC_DLOG(ERROR)
660 << "No retransmittable packets, so RetransmitOldestPacket failed."; 660 << "No retransmittable packets, so RetransmitOldestPacket failed.";
661 return false; 661 return false;
662 } 662 }
663 663
664 void QuicSentPacketManager::RetransmitRtoPackets() { 664 void QuicSentPacketManager::RetransmitRtoPackets() {
665 QUIC_BUG_IF(pending_timer_transmission_count_ > 0) 665 QUIC_BUG_IF(pending_timer_transmission_count_ > 0)
666 << "Retransmissions already queued:" << pending_timer_transmission_count_; 666 << "Retransmissions already queued:" << pending_timer_transmission_count_;
667 // Mark two packets for retransmission. 667 // Mark two packets for retransmission.
668 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); 668 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked();
669 for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); 669 for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 QUIC_BUG << "Acked packet has zero sent time, largest_observed:" 757 QUIC_BUG << "Acked packet has zero sent time, largest_observed:"
758 << ack_frame.largest_observed; 758 << ack_frame.largest_observed;
759 return false; 759 return false;
760 } 760 }
761 761
762 QuicTime::Delta send_delta = ack_receive_time - transmission_info.sent_time; 762 QuicTime::Delta send_delta = ack_receive_time - transmission_info.sent_time;
763 const int kMaxSendDeltaSeconds = 30; 763 const int kMaxSendDeltaSeconds = 30;
764 if (!FLAGS_quic_reloadable_flag_quic_allow_large_send_deltas && 764 if (!FLAGS_quic_reloadable_flag_quic_allow_large_send_deltas &&
765 send_delta.ToSeconds() > kMaxSendDeltaSeconds) { 765 send_delta.ToSeconds() > kMaxSendDeltaSeconds) {
766 // send_delta can be very high if local clock is changed mid-connection. 766 // send_delta can be very high if local clock is changed mid-connection.
767 LOG(WARNING) << "Excessive send delta: " << send_delta.ToSeconds() 767 QUIC_LOG_FIRST_N(WARNING, 10)
768 << ", setting to: " << kMaxSendDeltaSeconds 768 << "Excessive send delta: " << send_delta.ToSeconds()
769 << " largest_observed:" << ack_frame.largest_observed 769 << ", setting to: " << kMaxSendDeltaSeconds
770 << " ack_receive_time:" << ack_receive_time.ToDebuggingValue() 770 << " largest_observed:" << ack_frame.largest_observed
771 << " sent_time:" 771 << " ack_receive_time:" << ack_receive_time.ToDebuggingValue()
772 << transmission_info.sent_time.ToDebuggingValue(); 772 << " sent_time:" << transmission_info.sent_time.ToDebuggingValue();
773 return false; 773 return false;
774 } 774 }
775 rtt_stats_.UpdateRtt(send_delta, ack_frame.ack_delay_time, ack_receive_time); 775 rtt_stats_.UpdateRtt(send_delta, ack_frame.ack_delay_time, ack_receive_time);
776 776
777 return true; 777 return true;
778 } 778 }
779 779
780 QuicTime::Delta QuicSentPacketManager::TimeUntilSend(QuicTime now, 780 QuicTime::Delta QuicSentPacketManager::TimeUntilSend(QuicTime now,
781 QuicPathId* path_id) { 781 QuicPathId* path_id) {
782 QuicTime::Delta delay = QuicTime::Delta::Infinite(); 782 QuicTime::Delta delay = QuicTime::Delta::Infinite();
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 1019
1020 void QuicSentPacketManager::OnApplicationLimited() { 1020 void QuicSentPacketManager::OnApplicationLimited() {
1021 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight()); 1021 send_algorithm_->OnApplicationLimited(unacked_packets_.bytes_in_flight());
1022 } 1022 }
1023 1023
1024 const SendAlgorithmInterface* QuicSentPacketManager::GetSendAlgorithm() const { 1024 const SendAlgorithmInterface* QuicSentPacketManager::GetSendAlgorithm() const {
1025 return send_algorithm_.get(); 1025 return send_algorithm_.get();
1026 } 1026 }
1027 1027
1028 } // namespace net 1028 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_received_packet_manager.cc ('k') | net/quic/core/quic_server_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698