| 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 332     TransmissionType retransmission_type) { | 332     TransmissionType retransmission_type) { | 
| 333   DCHECK(retransmission_type == ALL_UNACKED_RETRANSMISSION || | 333   DCHECK(retransmission_type == ALL_UNACKED_RETRANSMISSION || | 
| 334          retransmission_type == ALL_INITIAL_RETRANSMISSION); | 334          retransmission_type == ALL_INITIAL_RETRANSMISSION); | 
| 335   QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); | 335   QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); | 
| 336   for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); | 336   for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); | 
| 337        it != unacked_packets_.end(); ++it, ++packet_number) { | 337        it != unacked_packets_.end(); ++it, ++packet_number) { | 
| 338     if (!it->retransmittable_frames.empty() && | 338     if (!it->retransmittable_frames.empty() && | 
| 339         (retransmission_type == ALL_UNACKED_RETRANSMISSION || | 339         (retransmission_type == ALL_UNACKED_RETRANSMISSION || | 
| 340          it->encryption_level == ENCRYPTION_INITIAL)) { | 340          it->encryption_level == ENCRYPTION_INITIAL)) { | 
| 341       MarkForRetransmission(packet_number, retransmission_type); | 341       MarkForRetransmission(packet_number, retransmission_type); | 
| 342     } else if (it->is_fec_packet) { |  | 
| 343       // Remove FEC packets from the packet map, since we can't retransmit them. |  | 
| 344       unacked_packets_.RemoveFromInFlight(packet_number); |  | 
| 345     } | 342     } | 
| 346   } | 343   } | 
| 347 } | 344 } | 
| 348 | 345 | 
| 349 void QuicSentPacketManager::NeuterUnencryptedPackets() { | 346 void QuicSentPacketManager::NeuterUnencryptedPackets() { | 
| 350   QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); | 347   QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); | 
| 351   for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); | 348   for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); | 
| 352        it != unacked_packets_.end(); ++it, ++packet_number) { | 349        it != unacked_packets_.end(); ++it, ++packet_number) { | 
| 353     if (!it->retransmittable_frames.empty() && | 350     if (!it->retransmittable_frames.empty() && | 
| 354         it->encryption_level == ENCRYPTION_NONE) { | 351         it->encryption_level == ENCRYPTION_NONE) { | 
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 554       QUIC_BUG << "Expected packet number to be in " | 551       QUIC_BUG << "Expected packet number to be in " | 
| 555                << "pending_retransmissions_.  packet_number: " | 552                << "pending_retransmissions_.  packet_number: " | 
| 556                << original_packet_number; | 553                << original_packet_number; | 
| 557     } | 554     } | 
| 558   } | 555   } | 
| 559 | 556 | 
| 560   if (pending_timer_transmission_count_ > 0) { | 557   if (pending_timer_transmission_count_ > 0) { | 
| 561     --pending_timer_transmission_count_; | 558     --pending_timer_transmission_count_; | 
| 562   } | 559   } | 
| 563 | 560 | 
| 564   // Only track packets as in flight that the send algorithm wants us to track. |  | 
| 565   // Since FEC packets should also be counted towards the congestion window, |  | 
| 566   // consider them as retransmittable for the purposes of congestion control. |  | 
| 567   HasRetransmittableData has_congestion_controlled_data = |  | 
| 568       serialized_packet->is_fec_packet ? HAS_RETRANSMITTABLE_DATA |  | 
| 569                                        : has_retransmittable_data; |  | 
| 570   // TODO(ianswett): Remove sent_time, because it's unused. | 561   // TODO(ianswett): Remove sent_time, because it's unused. | 
| 571   const bool in_flight = send_algorithm_->OnPacketSent( | 562   const bool in_flight = send_algorithm_->OnPacketSent( | 
| 572       sent_time, unacked_packets_.bytes_in_flight(), packet_number, | 563       sent_time, unacked_packets_.bytes_in_flight(), packet_number, | 
| 573       serialized_packet->encrypted_length, has_congestion_controlled_data); | 564       serialized_packet->encrypted_length, has_retransmittable_data); | 
| 574 | 565 | 
| 575   unacked_packets_.AddSentPacket(serialized_packet, original_packet_number, | 566   unacked_packets_.AddSentPacket(serialized_packet, original_packet_number, | 
| 576                                  transmission_type, sent_time, in_flight); | 567                                  transmission_type, sent_time, in_flight); | 
| 577   // Reset the retransmission timer anytime a pending packet is sent. | 568   // Reset the retransmission timer anytime a pending packet is sent. | 
| 578   return in_flight; | 569   return in_flight; | 
| 579 } | 570 } | 
| 580 | 571 | 
| 581 void QuicSentPacketManager::OnRetransmissionTimeout() { | 572 void QuicSentPacketManager::OnRetransmissionTimeout() { | 
| 582   DCHECK(unacked_packets_.HasInFlightPackets()); | 573   DCHECK(unacked_packets_.HasInFlightPackets()); | 
| 583   DCHECK_EQ(0u, pending_timer_transmission_count_); | 574   DCHECK_EQ(0u, pending_timer_transmission_count_); | 
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 968 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( | 959 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( | 
| 969     QuicPacketNumber packet_number) { | 960     QuicPacketNumber packet_number) { | 
| 970   return unacked_packets_.GetMutableTransmissionInfo(packet_number); | 961   return unacked_packets_.GetMutableTransmissionInfo(packet_number); | 
| 971 } | 962 } | 
| 972 | 963 | 
| 973 void QuicSentPacketManager::RemoveObsoletePackets() { | 964 void QuicSentPacketManager::RemoveObsoletePackets() { | 
| 974   unacked_packets_.RemoveObsoletePackets(); | 965   unacked_packets_.RemoveObsoletePackets(); | 
| 975 } | 966 } | 
| 976 | 967 | 
| 977 }  // namespace net | 968 }  // namespace net | 
| OLD | NEW | 
|---|