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

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

Issue 110383006: QuicSentPacketManager cleanup to simplify OnAbandonFECTimeout() and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 "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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 } 594 }
595 } 595 }
596 } 596 }
597 597
598 QuicTime QuicSentPacketManager::OnAbandonFecTimeout() { 598 QuicTime QuicSentPacketManager::OnAbandonFecTimeout() {
599 // Abandon all the FEC packets older than the current RTO, then reschedule 599 // Abandon all the FEC packets older than the current RTO, then reschedule
600 // the alarm if there are more pending fec packets. 600 // the alarm if there are more pending fec packets.
601 QuicTime::Delta retransmission_delay = GetRetransmissionDelay(); 601 QuicTime::Delta retransmission_delay = GetRetransmissionDelay();
602 QuicTime max_send_time = 602 QuicTime max_send_time =
603 clock_->ApproximateNow().Subtract(retransmission_delay); 603 clock_->ApproximateNow().Subtract(retransmission_delay);
604 while (HasUnackedFecPackets()) { 604 while (!unacked_fec_packets_.empty()) {
605 QuicPacketSequenceNumber oldest_unacked_fec = GetLeastUnackedFecPacket(); 605 UnackedFecPacketMap::iterator it = unacked_fec_packets_.begin();
606 QuicTime fec_sent_time = GetFecSentTime(oldest_unacked_fec); 606 QuicTime fec_sent_time = it->second;
607 if (fec_sent_time > max_send_time) { 607 if (fec_sent_time > max_send_time) {
608 return fec_sent_time.Add(retransmission_delay); 608 return fec_sent_time.Add(retransmission_delay);
609 } 609 }
610 DiscardFecPacket(oldest_unacked_fec); 610 OnPacketAbandoned(it->first);
611 OnPacketAbandoned(oldest_unacked_fec); 611 unacked_fec_packets_.erase(it++);
612 } 612 }
613 613
614 return QuicTime::Zero(); 614 return QuicTime::Zero();
615 } 615 }
616 616
617 void QuicSentPacketManager::OnPacketAbandoned( 617 void QuicSentPacketManager::OnPacketAbandoned(
618 QuicPacketSequenceNumber sequence_number) { 618 QuicPacketSequenceNumber sequence_number) {
619 SequenceNumberSet::iterator it = pending_packets_.find(sequence_number); 619 SequenceNumberSet::iterator it = pending_packets_.find(sequence_number);
620 if (it != pending_packets_.end()) { 620 if (it != pending_packets_.end()) {
621 DCHECK(ContainsKey(packet_history_map_, sequence_number)); 621 DCHECK(ContainsKey(packet_history_map_, sequence_number));
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 744
745 QuicTime::Delta QuicSentPacketManager::TimeUntilSend( 745 QuicTime::Delta QuicSentPacketManager::TimeUntilSend(
746 QuicTime now, 746 QuicTime now,
747 TransmissionType transmission_type, 747 TransmissionType transmission_type,
748 HasRetransmittableData retransmittable, 748 HasRetransmittableData retransmittable,
749 IsHandshake handshake) { 749 IsHandshake handshake) {
750 return send_algorithm_->TimeUntilSend(now, transmission_type, retransmittable, 750 return send_algorithm_->TimeUntilSend(now, transmission_type, retransmittable,
751 handshake); 751 handshake);
752 } 752 }
753 753
754 const QuicTime::Delta QuicSentPacketManager::DefaultRetransmissionTime() {
755 return QuicTime::Delta::FromMilliseconds(kDefaultRetransmissionTimeMs);
756 }
757
758 // Ensures that the Delayed Ack timer is always set to a value lesser 754 // Ensures that the Delayed Ack timer is always set to a value lesser
759 // than the retransmission timer's minimum value (MinRTO). We want the 755 // than the retransmission timer's minimum value (MinRTO). We want the
760 // delayed ack to get back to the QUIC peer before the sender's 756 // delayed ack to get back to the QUIC peer before the sender's
761 // retransmission timer triggers. Since we do not know the 757 // retransmission timer triggers. Since we do not know the
762 // reverse-path one-way delay, we assume equal delays for forward and 758 // reverse-path one-way delay, we assume equal delays for forward and
763 // reverse paths, and ensure that the timer is set to less than half 759 // reverse paths, and ensure that the timer is set to less than half
764 // of the MinRTO. 760 // of the MinRTO.
765 // There may be a value in making this delay adaptive with the help of 761 // There may be a value in making this delay adaptive with the help of
766 // the sender and a signaling mechanism -- if the sender uses a 762 // the sender and a signaling mechanism -- if the sender uses a
767 // different MinRTO, we may get spurious retransmissions. May not have 763 // different MinRTO, we may get spurious retransmissions. May not have
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 return; 849 return;
854 } 850 }
855 851
856 using_pacing_ = true; 852 using_pacing_ = true;
857 send_algorithm_.reset( 853 send_algorithm_.reset(
858 new PacingSender(send_algorithm_.release(), 854 new PacingSender(send_algorithm_.release(),
859 QuicTime::Delta::FromMicroseconds(1))); 855 QuicTime::Delta::FromMicroseconds(1)));
860 } 856 }
861 857
862 } // namespace net 858 } // 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