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

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

Issue 306013009: Remove the TransmissionType argument from QuicConnection CanWrite and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | no next file » | 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/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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 is_server_(is_server), 62 is_server_(is_server),
63 clock_(clock), 63 clock_(clock),
64 stats_(stats), 64 stats_(stats),
65 send_algorithm_( 65 send_algorithm_(
66 SendAlgorithmInterface::Create(clock, &rtt_stats_, type, stats)), 66 SendAlgorithmInterface::Create(clock, &rtt_stats_, type, stats)),
67 loss_algorithm_(LossDetectionInterface::Create(loss_type)), 67 loss_algorithm_(LossDetectionInterface::Create(loss_type)),
68 largest_observed_(0), 68 largest_observed_(0),
69 consecutive_rto_count_(0), 69 consecutive_rto_count_(0),
70 consecutive_tlp_count_(0), 70 consecutive_tlp_count_(0),
71 consecutive_crypto_retransmission_count_(0), 71 consecutive_crypto_retransmission_count_(0),
72 pending_tlp_transmission_(false),
72 max_tail_loss_probes_(kDefaultMaxTailLossProbes), 73 max_tail_loss_probes_(kDefaultMaxTailLossProbes),
73 using_pacing_(false) { 74 using_pacing_(false) {
74 } 75 }
75 76
76 QuicSentPacketManager::~QuicSentPacketManager() { 77 QuicSentPacketManager::~QuicSentPacketManager() {
77 } 78 }
78 79
79 void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) { 80 void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) {
80 if (config.HasReceivedInitialRoundTripTimeUs() && 81 if (config.HasReceivedInitialRoundTripTimeUs() &&
81 config.ReceivedInitialRoundTripTimeUs() > 0) { 82 config.ReceivedInitialRoundTripTimeUs() > 0) {
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 396 }
396 397
397 bool QuicSentPacketManager::OnPacketSent( 398 bool QuicSentPacketManager::OnPacketSent(
398 QuicPacketSequenceNumber sequence_number, 399 QuicPacketSequenceNumber sequence_number,
399 QuicTime sent_time, 400 QuicTime sent_time,
400 QuicByteCount bytes, 401 QuicByteCount bytes,
401 TransmissionType transmission_type, 402 TransmissionType transmission_type,
402 HasRetransmittableData has_retransmittable_data) { 403 HasRetransmittableData has_retransmittable_data) {
403 DCHECK_LT(0u, sequence_number); 404 DCHECK_LT(0u, sequence_number);
404 LOG_IF(DFATAL, bytes == 0) << "Cannot send empty packets."; 405 LOG_IF(DFATAL, bytes == 0) << "Cannot send empty packets.";
406 pending_tlp_transmission_ = false;
405 // In rare circumstances, the packet could be serialized, sent, and then acked 407 // In rare circumstances, the packet could be serialized, sent, and then acked
406 // before OnPacketSent is called. 408 // before OnPacketSent is called.
407 if (!unacked_packets_.IsUnacked(sequence_number)) { 409 if (!unacked_packets_.IsUnacked(sequence_number)) {
408 return false; 410 return false;
409 } 411 }
410 412
411 if (unacked_packets_.bytes_in_flight() == 0) { 413 if (unacked_packets_.bytes_in_flight() == 0) {
412 // TODO(ianswett): Consider being less aggressive to force a new 414 // TODO(ianswett): Consider being less aggressive to force a new
413 // recent_min_rtt, likely by not discarding a relatively new sample. 415 // recent_min_rtt, likely by not discarding a relatively new sample.
414 DVLOG(1) << "Sampling a new recent min rtt within 2 samples. currently:" 416 DVLOG(1) << "Sampling a new recent min rtt within 2 samples. currently:"
(...skipping 30 matching lines...) Expand all
445 ++stats_->loss_timeout_count; 447 ++stats_->loss_timeout_count;
446 QuicByteCount bytes_in_flight = unacked_packets_.bytes_in_flight(); 448 QuicByteCount bytes_in_flight = unacked_packets_.bytes_in_flight();
447 InvokeLossDetection(clock_->Now()); 449 InvokeLossDetection(clock_->Now());
448 MaybeInvokeCongestionEvent(false, bytes_in_flight); 450 MaybeInvokeCongestionEvent(false, bytes_in_flight);
449 return; 451 return;
450 } 452 }
451 case TLP_MODE: 453 case TLP_MODE:
452 // If no tail loss probe can be sent, because there are no retransmittable 454 // If no tail loss probe can be sent, because there are no retransmittable
453 // packets, execute a conventional RTO to abandon old packets. 455 // packets, execute a conventional RTO to abandon old packets.
454 ++stats_->tlp_count; 456 ++stats_->tlp_count;
457 pending_tlp_transmission_ = true;
455 RetransmitOldestPacket(); 458 RetransmitOldestPacket();
456 return; 459 return;
457 case RTO_MODE: 460 case RTO_MODE:
458 ++stats_->rto_count; 461 ++stats_->rto_count;
459 RetransmitAllPackets(); 462 RetransmitAllPackets();
460 return; 463 return;
461 } 464 }
462 } 465 }
463 466
464 void QuicSentPacketManager::RetransmitCryptoPackets() { 467 void QuicSentPacketManager::RetransmitCryptoPackets() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } 499 }
497 DCHECK_NE(IS_HANDSHAKE, frames->HasCryptoHandshake()); 500 DCHECK_NE(IS_HANDSHAKE, frames->HasCryptoHandshake());
498 MarkForRetransmission(sequence_number, TLP_RETRANSMISSION); 501 MarkForRetransmission(sequence_number, TLP_RETRANSMISSION);
499 return; 502 return;
500 } 503 }
501 DLOG(FATAL) 504 DLOG(FATAL)
502 << "No retransmittable packets, so RetransmitOldestPacket failed."; 505 << "No retransmittable packets, so RetransmitOldestPacket failed.";
503 } 506 }
504 507
505 void QuicSentPacketManager::RetransmitAllPackets() { 508 void QuicSentPacketManager::RetransmitAllPackets() {
506 // Abandon all retransmittable packets and packets older than the 509 DVLOG(1) << "RetransmitAllPackets() called with "
507 // retransmission delay.
508
509 DVLOG(1) << "OnRetransmissionTimeout() fired with "
510 << unacked_packets_.GetNumUnackedPackets() << " unacked packets."; 510 << unacked_packets_.GetNumUnackedPackets() << " unacked packets.";
511
512 // Request retransmission of all retransmittable packets when the RTO 511 // Request retransmission of all retransmittable packets when the RTO
513 // fires, and let the congestion manager decide how many to send 512 // fires, and let the congestion manager decide how many to send
514 // immediately and the remaining packets will be queued. 513 // immediately and the remaining packets will be queued.
515 // Abandon any non-retransmittable packets that are sufficiently old. 514 // Abandon any non-retransmittable packets that are sufficiently old.
516 bool packets_retransmitted = false; 515 bool packets_retransmitted = false;
517 QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); 516 QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin();
518 while (it != unacked_packets_.end()) { 517 while (it != unacked_packets_.end()) {
519 const RetransmittableFrames* frames = it->second.retransmittable_frames; 518 const RetransmittableFrames* frames = it->second.retransmittable_frames;
520 QuicPacketSequenceNumber sequence_number = it->first; 519 QuicPacketSequenceNumber sequence_number = it->first;
521 ++it; 520 ++it;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 603
605 QuicTime::Delta send_delta = 604 QuicTime::Delta send_delta =
606 ack_receive_time.Subtract(transmission_info.sent_time); 605 ack_receive_time.Subtract(transmission_info.sent_time);
607 rtt_stats_.UpdateRtt( 606 rtt_stats_.UpdateRtt(
608 send_delta, received_info.delta_time_largest_observed, ack_receive_time); 607 send_delta, received_info.delta_time_largest_observed, ack_receive_time);
609 return true; 608 return true;
610 } 609 }
611 610
612 QuicTime::Delta QuicSentPacketManager::TimeUntilSend( 611 QuicTime::Delta QuicSentPacketManager::TimeUntilSend(
613 QuicTime now, 612 QuicTime now,
614 TransmissionType transmission_type,
615 HasRetransmittableData retransmittable) { 613 HasRetransmittableData retransmittable) {
616 // The TLP logic is entirely contained within QuicSentPacketManager, so the 614 // The TLP logic is entirely contained within QuicSentPacketManager, so the
617 // send algorithm does not need to be consulted. 615 // send algorithm does not need to be consulted.
618 if (transmission_type == TLP_RETRANSMISSION) { 616 if (pending_tlp_transmission_) {
619 return QuicTime::Delta::Zero(); 617 return QuicTime::Delta::Zero();
620 } 618 }
621 return send_algorithm_->TimeUntilSend( 619 return send_algorithm_->TimeUntilSend(
622 now, unacked_packets_.bytes_in_flight(), retransmittable); 620 now, unacked_packets_.bytes_in_flight(), retransmittable);
623 } 621 }
624 622
625 // Ensures that the Delayed Ack timer is always set to a value lesser 623 // Ensures that the Delayed Ack timer is always set to a value lesser
626 // than the retransmission timer's minimum value (MinRTO). We want the 624 // than the retransmission timer's minimum value (MinRTO). We want the
627 // delayed ack to get back to the QUIC peer before the sender's 625 // delayed ack to get back to the QUIC peer before the sender's
628 // retransmission timer triggers. Since we do not know the 626 // retransmission timer triggers. Since we do not know the
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 return; 735 return;
738 } 736 }
739 737
740 using_pacing_ = true; 738 using_pacing_ = true;
741 send_algorithm_.reset( 739 send_algorithm_.reset(
742 new PacingSender(send_algorithm_.release(), 740 new PacingSender(send_algorithm_.release(),
743 QuicTime::Delta::FromMicroseconds(1))); 741 QuicTime::Delta::FromMicroseconds(1)));
744 } 742 }
745 743
746 } // namespace net 744 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698