OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |