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

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

Issue 1979763002: Landing Recent QUIC changes until Sun May 8 00:39:29 2016 +0000 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/quic_sent_packet_manager.h ('k') | net/quic/quic_sent_packet_manager_test.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/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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 max(kMinInitialRoundTripTimeUs, 111 max(kMinInitialRoundTripTimeUs,
112 min(kMaxInitialRoundTripTimeUs, 112 min(kMaxInitialRoundTripTimeUs,
113 config.ReceivedInitialRoundTripTimeUs()))); 113 config.ReceivedInitialRoundTripTimeUs())));
114 } else if (config.HasInitialRoundTripTimeUsToSend() && 114 } else if (config.HasInitialRoundTripTimeUsToSend() &&
115 config.GetInitialRoundTripTimeUsToSend() > 0) { 115 config.GetInitialRoundTripTimeUsToSend() > 0) {
116 rtt_stats_.set_initial_rtt_us( 116 rtt_stats_.set_initial_rtt_us(
117 max(kMinInitialRoundTripTimeUs, 117 max(kMinInitialRoundTripTimeUs,
118 min(kMaxInitialRoundTripTimeUs, 118 min(kMaxInitialRoundTripTimeUs,
119 config.GetInitialRoundTripTimeUsToSend()))); 119 config.GetInitialRoundTripTimeUsToSend())));
120 } 120 }
121 // Initial RTT may have changed.
122 if (network_change_visitor_ != nullptr) {
123 network_change_visitor_->OnRttChange();
124 }
125 // TODO(ianswett): BBR is currently a server only feature. 121 // TODO(ianswett): BBR is currently a server only feature.
126 if (FLAGS_quic_allow_bbr && config.HasReceivedConnectionOptions() && 122 if (FLAGS_quic_allow_bbr && config.HasReceivedConnectionOptions() &&
127 ContainsQuicTag(config.ReceivedConnectionOptions(), kTBBR)) { 123 ContainsQuicTag(config.ReceivedConnectionOptions(), kTBBR)) {
128 if (FLAGS_quic_recent_min_rtt_window_s > 0) { 124 if (FLAGS_quic_recent_min_rtt_window_s > 0) {
129 rtt_stats_.set_recent_min_rtt_window( 125 rtt_stats_.set_recent_min_rtt_window(
130 QuicTime::Delta::FromSeconds(FLAGS_quic_recent_min_rtt_window_s)); 126 QuicTime::Delta::FromSeconds(FLAGS_quic_recent_min_rtt_window_s));
131 } 127 }
132 send_algorithm_.reset(SendAlgorithmInterface::Create( 128 send_algorithm_.reset(SendAlgorithmInterface::Create(
133 clock_, &rtt_stats_, kBBR, stats_, initial_congestion_window_)); 129 clock_, &rtt_stats_, kBBR, stats_, initial_congestion_window_));
134 } 130 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 receive_buffer_bytes_ = 174 receive_buffer_bytes_ =
179 max(kMinSocketReceiveBuffer, 175 max(kMinSocketReceiveBuffer,
180 static_cast<QuicByteCount>(config.ReceivedSocketReceiveBuffer())); 176 static_cast<QuicByteCount>(config.ReceivedSocketReceiveBuffer()));
181 QuicByteCount max_cwnd_bytes = static_cast<QuicByteCount>( 177 QuicByteCount max_cwnd_bytes = static_cast<QuicByteCount>(
182 receive_buffer_bytes_ * kConservativeReceiveBufferFraction); 178 receive_buffer_bytes_ * kConservativeReceiveBufferFraction);
183 send_algorithm_->SetMaxCongestionWindow(max_cwnd_bytes); 179 send_algorithm_->SetMaxCongestionWindow(max_cwnd_bytes);
184 } 180 }
185 send_algorithm_->SetFromConfig(config, perspective_); 181 send_algorithm_->SetFromConfig(config, perspective_);
186 182
187 if (network_change_visitor_ != nullptr) { 183 if (network_change_visitor_ != nullptr) {
188 network_change_visitor_->OnCongestionWindowChange(); 184 network_change_visitor_->OnCongestionChange();
189 } 185 }
190 } 186 }
191 187
192 void QuicSentPacketManager::ResumeConnectionState( 188 void QuicSentPacketManager::ResumeConnectionState(
193 const CachedNetworkParameters& cached_network_params, 189 const CachedNetworkParameters& cached_network_params,
194 bool max_bandwidth_resumption) { 190 bool max_bandwidth_resumption) {
195 if (cached_network_params.has_min_rtt_ms()) { 191 if (cached_network_params.has_min_rtt_ms()) {
196 uint32_t initial_rtt_us = 192 uint32_t initial_rtt_us =
197 kNumMicrosPerMilli * cached_network_params.min_rtt_ms(); 193 kNumMicrosPerMilli * cached_network_params.min_rtt_ms();
198 rtt_stats_.set_initial_rtt_us( 194 rtt_stats_.set_initial_rtt_us(
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 bool rtt_updated, 279 bool rtt_updated,
284 QuicByteCount bytes_in_flight) { 280 QuicByteCount bytes_in_flight) {
285 if (!rtt_updated && packets_acked_.empty() && packets_lost_.empty()) { 281 if (!rtt_updated && packets_acked_.empty() && packets_lost_.empty()) {
286 return; 282 return;
287 } 283 }
288 send_algorithm_->OnCongestionEvent(rtt_updated, bytes_in_flight, 284 send_algorithm_->OnCongestionEvent(rtt_updated, bytes_in_flight,
289 packets_acked_, packets_lost_); 285 packets_acked_, packets_lost_);
290 packets_acked_.clear(); 286 packets_acked_.clear();
291 packets_lost_.clear(); 287 packets_lost_.clear();
292 if (network_change_visitor_ != nullptr) { 288 if (network_change_visitor_ != nullptr) {
293 network_change_visitor_->OnCongestionWindowChange(); 289 network_change_visitor_->OnCongestionChange();
294 } 290 }
295 } 291 }
296 292
297 void QuicSentPacketManager::HandleAckForSentPackets( 293 void QuicSentPacketManager::HandleAckForSentPackets(
298 const QuicAckFrame& ack_frame) { 294 const QuicAckFrame& ack_frame) {
299 // Go through the packets we have not received an ack for and see if this 295 // Go through the packets we have not received an ack for and see if this
300 // incoming_ack shows they've been seen by the peer. 296 // incoming_ack shows they've been seen by the peer.
301 QuicTime::Delta ack_delay_time = ack_frame.ack_delay_time; 297 QuicTime::Delta ack_delay_time = ack_frame.ack_delay_time;
302 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); 298 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked();
303 for (QuicUnackedPacketMap::iterator it = unacked_packets_.begin(); 299 for (QuicUnackedPacketMap::iterator it = unacked_packets_.begin();
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 bool QuicSentPacketManager::HasUnackedPackets() const { 544 bool QuicSentPacketManager::HasUnackedPackets() const {
549 return unacked_packets_.HasUnackedPackets(); 545 return unacked_packets_.HasUnackedPackets();
550 } 546 }
551 547
552 QuicPacketNumber QuicSentPacketManager::GetLeastUnacked() const { 548 QuicPacketNumber QuicSentPacketManager::GetLeastUnacked() const {
553 return unacked_packets_.GetLeastUnacked(); 549 return unacked_packets_.GetLeastUnacked();
554 } 550 }
555 551
556 bool QuicSentPacketManager::OnPacketSent( 552 bool QuicSentPacketManager::OnPacketSent(
557 SerializedPacket* serialized_packet, 553 SerializedPacket* serialized_packet,
554 QuicPathId /*original_path_id*/,
558 QuicPacketNumber original_packet_number, 555 QuicPacketNumber original_packet_number,
559 QuicTime sent_time, 556 QuicTime sent_time,
560 TransmissionType transmission_type, 557 TransmissionType transmission_type,
561 HasRetransmittableData has_retransmittable_data) { 558 HasRetransmittableData has_retransmittable_data) {
562 QuicPacketNumber packet_number = serialized_packet->packet_number; 559 QuicPacketNumber packet_number = serialized_packet->packet_number;
563 DCHECK_LT(0u, packet_number); 560 DCHECK_LT(0u, packet_number);
564 DCHECK(!unacked_packets_.IsUnacked(packet_number)); 561 DCHECK(!unacked_packets_.IsUnacked(packet_number));
565 QUIC_BUG_IF(serialized_packet->encrypted_length == 0) 562 QUIC_BUG_IF(serialized_packet->encrypted_length == 0)
566 << "Cannot send empty packets."; 563 << "Cannot send empty packets.";
567 564
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 if (transmission_info.sent_time == QuicTime::Zero()) { 761 if (transmission_info.sent_time == QuicTime::Zero()) {
765 QUIC_BUG << "Acked packet has zero sent time, largest_observed:" 762 QUIC_BUG << "Acked packet has zero sent time, largest_observed:"
766 << ack_frame.largest_observed; 763 << ack_frame.largest_observed;
767 return false; 764 return false;
768 } 765 }
769 766
770 QuicTime::Delta send_delta = 767 QuicTime::Delta send_delta =
771 ack_receive_time.Subtract(transmission_info.sent_time); 768 ack_receive_time.Subtract(transmission_info.sent_time);
772 rtt_stats_.UpdateRtt(send_delta, ack_frame.ack_delay_time, ack_receive_time); 769 rtt_stats_.UpdateRtt(send_delta, ack_frame.ack_delay_time, ack_receive_time);
773 770
774 if (network_change_visitor_ != nullptr) {
775 network_change_visitor_->OnRttChange();
776 }
777
778 return true; 771 return true;
779 } 772 }
780 773
781 QuicTime::Delta QuicSentPacketManager::TimeUntilSend( 774 QuicTime::Delta QuicSentPacketManager::TimeUntilSend(
782 QuicTime now, 775 QuicTime now,
783 HasRetransmittableData retransmittable) { 776 HasRetransmittableData retransmittable) {
784 // The TLP logic is entirely contained within QuicSentPacketManager, so the 777 // The TLP logic is entirely contained within QuicSentPacketManager, so the
785 // send algorithm does not need to be consulted. 778 // send algorithm does not need to be consulted.
786 if (pending_timer_transmission_count_ > 0) { 779 if (pending_timer_transmission_count_ > 0) {
787 return QuicTime::Delta::Zero(); 780 return QuicTime::Delta::Zero();
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( 975 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo(
983 QuicPacketNumber packet_number) { 976 QuicPacketNumber packet_number) {
984 return unacked_packets_.GetMutableTransmissionInfo(packet_number); 977 return unacked_packets_.GetMutableTransmissionInfo(packet_number);
985 } 978 }
986 979
987 void QuicSentPacketManager::RemoveObsoletePackets() { 980 void QuicSentPacketManager::RemoveObsoletePackets() {
988 unacked_packets_.RemoveObsoletePackets(); 981 unacked_packets_.RemoveObsoletePackets();
989 } 982 }
990 983
991 } // namespace net 984 } // namespace net
OLDNEW
« 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