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

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

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | net/quic/quic_server.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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 max(kMinSocketReceiveBuffer, 156 max(kMinSocketReceiveBuffer,
157 static_cast<QuicByteCount>(config.ReceivedSocketReceiveBuffer())); 157 static_cast<QuicByteCount>(config.ReceivedSocketReceiveBuffer()));
158 } 158 }
159 send_algorithm_->SetFromConfig(config, is_server_, using_pacing_); 159 send_algorithm_->SetFromConfig(config, is_server_, using_pacing_);
160 160
161 if (network_change_visitor_ != nullptr) { 161 if (network_change_visitor_ != nullptr) {
162 network_change_visitor_->OnCongestionWindowChange(); 162 network_change_visitor_->OnCongestionWindowChange();
163 } 163 }
164 } 164 }
165 165
166 void QuicSentPacketManager::ResumeConnectionState( 166 bool QuicSentPacketManager::ResumeConnectionState(
167 const CachedNetworkParameters& cached_network_params) { 167 const CachedNetworkParameters& cached_network_params) {
168 send_algorithm_->ResumeConnectionState(cached_network_params); 168 return send_algorithm_->ResumeConnectionState(cached_network_params);
169 } 169 }
170 170
171 void QuicSentPacketManager::SetNumOpenStreams(size_t num_streams) { 171 void QuicSentPacketManager::SetNumOpenStreams(size_t num_streams) {
172 if (n_connection_simulation_) { 172 if (n_connection_simulation_) {
173 // Ensure the number of connections is between 1 and 5. 173 // Ensure the number of connections is between 1 and 5.
174 send_algorithm_->SetNumEmulatedConnections( 174 send_algorithm_->SetNumEmulatedConnections(
175 min<size_t>(5, max<size_t>(1, num_streams))); 175 min<size_t>(5, max<size_t>(1, num_streams)));
176 } 176 }
177 } 177 }
178 178
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 if (ContainsKey(ack_frame.missing_packets, sequence_number)) { 278 if (ContainsKey(ack_frame.missing_packets, sequence_number)) {
279 // Don't continue to increase the nack count for packets not in flight. 279 // Don't continue to increase the nack count for packets not in flight.
280 if (!it->in_flight) { 280 if (!it->in_flight) {
281 continue; 281 continue;
282 } 282 }
283 // Consider it multiple nacks when there is a gap between the missing 283 // Consider it multiple nacks when there is a gap between the missing
284 // packet and the largest observed, since the purpose of a nack 284 // packet and the largest observed, since the purpose of a nack
285 // threshold is to tolerate re-ordering. This handles both StretchAcks 285 // threshold is to tolerate re-ordering. This handles both StretchAcks
286 // and Forward Acks. 286 // and Forward Acks.
287 // The nack count only increases when the largest observed increases. 287 // The nack count only increases when the largest observed increases.
288 size_t min_nacks = ack_frame.largest_observed - sequence_number; 288 QuicPacketCount min_nacks = ack_frame.largest_observed - sequence_number;
289 // Truncated acks can nack the largest observed, so use a min of 1. 289 // Truncated acks can nack the largest observed, so use a min of 1.
290 if (min_nacks == 0) { 290 if (min_nacks == 0) {
291 min_nacks = 1; 291 min_nacks = 1;
292 } 292 }
293 unacked_packets_.NackPacket(sequence_number, min_nacks); 293 unacked_packets_.NackPacket(sequence_number, min_nacks);
294 continue; 294 continue;
295 } 295 }
296 // Packet was acked, so remove it from our unacked packet list. 296 // Packet was acked, so remove it from our unacked packet list.
297 DVLOG(1) << ENDPOINT << "Got an ack for packet " << sequence_number; 297 DVLOG(1) << ENDPOINT << "Got an ack for packet " << sequence_number;
298 // If data is associated with the most recent transmission of this 298 // If data is associated with the most recent transmission of this
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as 933 // Set up a pacing sender with a 1 millisecond alarm granularity, the same as
934 // the default granularity of the Linux kernel's FQ qdisc. 934 // the default granularity of the Linux kernel's FQ qdisc.
935 using_pacing_ = true; 935 using_pacing_ = true;
936 send_algorithm_.reset( 936 send_algorithm_.reset(
937 new PacingSender(send_algorithm_.release(), 937 new PacingSender(send_algorithm_.release(),
938 QuicTime::Delta::FromMilliseconds(1), 938 QuicTime::Delta::FromMilliseconds(1),
939 kInitialUnpacedBurst)); 939 kInitialUnpacedBurst));
940 } 940 }
941 941
942 } // namespace net 942 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager.h ('k') | net/quic/quic_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698