OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_unacked_packet_map.h" | 5 #include "net/quic/quic_unacked_packet_map.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/quic_connection_stats.h" | 9 #include "net/quic/quic_connection_stats.h" |
10 #include "net/quic/quic_utils_chromium.h" | 10 #include "net/quic/quic_utils_chromium.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 DCHECK_GE(sequence_number, least_unacked_); | 293 DCHECK_GE(sequence_number, least_unacked_); |
294 DCHECK_LT(sequence_number, least_unacked_ + unacked_packets_.size()); | 294 DCHECK_LT(sequence_number, least_unacked_ + unacked_packets_.size()); |
295 TransmissionInfo* info = &unacked_packets_[sequence_number - least_unacked_]; | 295 TransmissionInfo* info = &unacked_packets_[sequence_number - least_unacked_]; |
296 if (info->in_flight) { | 296 if (info->in_flight) { |
297 LOG_IF(DFATAL, bytes_in_flight_ < info->bytes_sent); | 297 LOG_IF(DFATAL, bytes_in_flight_ < info->bytes_sent); |
298 bytes_in_flight_ -= info->bytes_sent; | 298 bytes_in_flight_ -= info->bytes_sent; |
299 info->in_flight = false; | 299 info->in_flight = false; |
300 } | 300 } |
301 } | 301 } |
302 | 302 |
| 303 void QuicUnackedPacketMap::StopRetransmissionForStream(QuicStreamId stream_id) { |
| 304 if (stream_id == kCryptoStreamId || stream_id == kHeadersStreamId) { |
| 305 LOG(DFATAL) << "Special streams must always retransmit data: " << stream_id; |
| 306 return; |
| 307 } |
| 308 QuicPacketSequenceNumber sequence_number = least_unacked_; |
| 309 for (UnackedPacketMap::const_iterator it = unacked_packets_.begin(); |
| 310 it != unacked_packets_.end(); ++it, ++sequence_number) { |
| 311 RetransmittableFrames* retransmittable_frames = it->retransmittable_frames; |
| 312 if (!retransmittable_frames) { |
| 313 continue; |
| 314 } |
| 315 retransmittable_frames->RemoveFramesForStream(stream_id); |
| 316 if (retransmittable_frames->frames().empty()) { |
| 317 RemoveRetransmittability(sequence_number); |
| 318 } |
| 319 } |
| 320 } |
| 321 |
303 bool QuicUnackedPacketMap::HasUnackedPackets() const { | 322 bool QuicUnackedPacketMap::HasUnackedPackets() const { |
304 return !unacked_packets_.empty(); | 323 return !unacked_packets_.empty(); |
305 } | 324 } |
306 | 325 |
307 bool QuicUnackedPacketMap::HasInFlightPackets() const { | 326 bool QuicUnackedPacketMap::HasInFlightPackets() const { |
308 return bytes_in_flight_ > 0; | 327 return bytes_in_flight_ > 0; |
309 } | 328 } |
310 | 329 |
311 const TransmissionInfo& QuicUnackedPacketMap::GetTransmissionInfo( | 330 const TransmissionInfo& QuicUnackedPacketMap::GetTransmissionInfo( |
312 QuicPacketSequenceNumber sequence_number) const { | 331 QuicPacketSequenceNumber sequence_number) const { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 } | 384 } |
366 } | 385 } |
367 return false; | 386 return false; |
368 } | 387 } |
369 | 388 |
370 QuicPacketSequenceNumber QuicUnackedPacketMap::GetLeastUnacked() const { | 389 QuicPacketSequenceNumber QuicUnackedPacketMap::GetLeastUnacked() const { |
371 return least_unacked_; | 390 return least_unacked_; |
372 } | 391 } |
373 | 392 |
374 } // namespace net | 393 } // namespace net |
OLD | NEW |