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

Unified Diff: net/quic/quic_sent_packet_manager.cc

Issue 497553004: Landing Recent QUIC Changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase with TOT Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | net/quic/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_sent_packet_manager.cc
diff --git a/net/quic/quic_sent_packet_manager.cc b/net/quic/quic_sent_packet_manager.cc
index 089b301d8b60c5cd1072b1bb22aa43a99972c00b..21a4fbcd84b6f16856a8ba4e21e8f2a851baee31 100644
--- a/net/quic/quic_sent_packet_manager.cc
+++ b/net/quic/quic_sent_packet_manager.cc
@@ -78,7 +78,7 @@ QuicSentPacketManager::QuicSentPacketManager(
congestion_control_type,
stats)),
loss_algorithm_(LossDetectionInterface::Create(loss_type)),
- largest_observed_(0),
+ least_packet_awaited_by_peer_(1),
first_rto_transmission_(0),
consecutive_rto_count_(0),
consecutive_tlp_count_(0),
@@ -113,8 +113,13 @@ void QuicSentPacketManager::SetFromConfig(const QuicConfig& config) {
send_algorithm_.reset(
SendAlgorithmInterface::Create(clock_, &rtt_stats_, kReno, stats_));
}
- if (config.HasReceivedConnectionOptions() &&
- ContainsQuicTag(config.ReceivedConnectionOptions(), kPACE)) {
+ if (is_server_) {
+ if (config.HasReceivedConnectionOptions() &&
+ ContainsQuicTag(config.ReceivedConnectionOptions(), kPACE)) {
+ EnablePacing();
+ }
+ } else if (config.HasSendConnectionOptions() &&
+ ContainsQuicTag(config.SendConnectionOptions(), kPACE)) {
EnablePacing();
}
// TODO(ianswett): Remove the "HasReceivedLossDetection" branch once
@@ -179,17 +184,25 @@ void QuicSentPacketManager::OnIncomingAck(const QuicAckFrame& ack_frame,
QuicTime ack_receive_time) {
QuicByteCount bytes_in_flight = unacked_packets_.bytes_in_flight();
+ UpdatePacketInformationReceivedByPeer(ack_frame);
// We rely on delta_time_largest_observed to compute an RTT estimate, so
// we only update rtt when the largest observed gets acked.
bool largest_observed_acked = MaybeUpdateRTT(ack_frame, ack_receive_time);
- if (largest_observed_ < ack_frame.largest_observed) {
- largest_observed_ = ack_frame.largest_observed;
- unacked_packets_.IncreaseLargestObserved(largest_observed_);
- }
+ DCHECK_GE(ack_frame.largest_observed, unacked_packets_.largest_observed());
+ unacked_packets_.IncreaseLargestObserved(ack_frame.largest_observed);
+
HandleAckForSentPackets(ack_frame);
InvokeLossDetection(ack_receive_time);
MaybeInvokeCongestionEvent(largest_observed_acked, bytes_in_flight);
+ sustained_bandwidth_recorder_.RecordEstimate(
+ send_algorithm_->InRecovery(),
+ send_algorithm_->InSlowStart(),
+ send_algorithm_->BandwidthEstimate(),
+ ack_receive_time,
+ clock_->WallNow(),
+ rtt_stats_.SmoothedRtt());
+
// If we have received a truncated ack, then we need to clear out some
// previous transmissions to allow the peer to actually ACK new packets.
if (ack_frame.is_truncated) {
@@ -209,12 +222,21 @@ void QuicSentPacketManager::OnIncomingAck(const QuicAckFrame& ack_frame,
if (debug_delegate_ != NULL) {
debug_delegate_->OnIncomingAck(ack_frame,
ack_receive_time,
- largest_observed_,
+ unacked_packets_.largest_observed(),
largest_observed_acked,
GetLeastUnackedSentPacket());
}
}
+void QuicSentPacketManager::UpdatePacketInformationReceivedByPeer(
+ const QuicAckFrame& ack_frame) {
+ if (ack_frame.missing_packets.empty()) {
+ least_packet_awaited_by_peer_ = ack_frame.largest_observed + 1;
+ } else {
+ least_packet_awaited_by_peer_ = *(ack_frame.missing_packets.begin());
+ }
+}
+
void QuicSentPacketManager::MaybeInvokeCongestionEvent(
bool rtt_updated, QuicByteCount bytes_in_flight) {
if (!rtt_updated && packets_acked_.empty() && packets_lost_.empty()) {
@@ -501,15 +523,11 @@ bool QuicSentPacketManager::OnPacketSent(
TransmissionType transmission_type,
HasRetransmittableData has_retransmittable_data) {
DCHECK_LT(0u, sequence_number);
+ DCHECK(unacked_packets_.IsUnacked(sequence_number));
LOG_IF(DFATAL, bytes == 0) << "Cannot send empty packets.";
if (pending_timer_transmission_count_ > 0) {
--pending_timer_transmission_count_;
}
- // In rare circumstances, the packet could be serialized, sent, and then acked
- // before OnPacketSent is called.
- if (!unacked_packets_.IsUnacked(sequence_number)) {
- return false;
- }
if (unacked_packets_.bytes_in_flight() == 0) {
// TODO(ianswett): Consider being less aggressive to force a new
@@ -680,7 +698,7 @@ void QuicSentPacketManager::InvokeLossDetection(QuicTime time) {
SequenceNumberSet lost_packets =
loss_algorithm_->DetectLostPackets(unacked_packets_,
time,
- largest_observed_,
+ unacked_packets_.largest_observed(),
rtt_stats_);
for (SequenceNumberSet::const_iterator it = lost_packets.begin();
it != lost_packets.end(); ++it) {
@@ -851,6 +869,11 @@ bool QuicSentPacketManager::HasReliableBandwidthEstimate() const {
return send_algorithm_->HasReliableBandwidthEstimate();
}
+const QuicSustainedBandwidthRecorder&
+QuicSentPacketManager::SustainedBandwidthRecorder() const {
+ return sustained_bandwidth_recorder_;
+}
+
QuicByteCount QuicSentPacketManager::GetCongestionWindow() const {
return send_algorithm_->GetCongestionWindow();
}
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | net/quic/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698