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

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

Issue 271443008: Minor QUIC cleanup to combine QuicUnackedPacketMap's RemovePacket and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sending for review Created 6 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 | Annotate | Revision Log
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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 330
331 const TransmissionInfo& transmission_info = 331 const TransmissionInfo& transmission_info =
332 unacked_packets_.GetTransmissionInfo(sequence_number); 332 unacked_packets_.GetTransmissionInfo(sequence_number);
333 // The AckNotifierManager needs to be notified for revived packets, 333 // The AckNotifierManager needs to be notified for revived packets,
334 // since it indicates the packet arrived from the appliction's perspective. 334 // since it indicates the packet arrived from the appliction's perspective.
335 if (transmission_info.retransmittable_frames) { 335 if (transmission_info.retransmittable_frames) {
336 ack_notifier_manager_.OnPacketAcked( 336 ack_notifier_manager_.OnPacketAcked(
337 sequence_number, delta_largest_observed); 337 sequence_number, delta_largest_observed);
338 } 338 }
339 339
340 if (!transmission_info.pending) { 340 unacked_packets_.NeuterIfPendingOrRemovePacket(sequence_number);
341 unacked_packets_.RemovePacket(sequence_number);
342 } else {
343 unacked_packets_.NeuterPacket(sequence_number);
344 }
345 } 341 }
346 342
347 QuicUnackedPacketMap::const_iterator QuicSentPacketManager::MarkPacketHandled( 343 QuicUnackedPacketMap::const_iterator QuicSentPacketManager::MarkPacketHandled(
348 QuicPacketSequenceNumber sequence_number, 344 QuicPacketSequenceNumber sequence_number,
349 QuicTime::Delta delta_largest_observed) { 345 QuicTime::Delta delta_largest_observed) {
350 if (!unacked_packets_.IsUnacked(sequence_number)) { 346 if (!unacked_packets_.IsUnacked(sequence_number)) {
351 LOG(DFATAL) << "Packet is not unacked: " << sequence_number; 347 LOG(DFATAL) << "Packet is not unacked: " << sequence_number;
352 return unacked_packets_.end(); 348 return unacked_packets_.end();
353 } 349 }
354 const TransmissionInfo& transmission_info = 350 const TransmissionInfo& transmission_info =
(...skipping 14 matching lines...) Expand all
369 365
370 // The AckNotifierManager needs to be notified about the most recent 366 // The AckNotifierManager needs to be notified about the most recent
371 // transmission, since that's the one only one it tracks. 367 // transmission, since that's the one only one it tracks.
372 ack_notifier_manager_.OnPacketAcked(newest_transmission, 368 ack_notifier_manager_.OnPacketAcked(newest_transmission,
373 delta_largest_observed); 369 delta_largest_observed);
374 370
375 bool has_crypto_handshake = HasCryptoHandshake( 371 bool has_crypto_handshake = HasCryptoHandshake(
376 unacked_packets_.GetTransmissionInfo(newest_transmission)); 372 unacked_packets_.GetTransmissionInfo(newest_transmission));
377 while (all_transmissions_it != all_transmissions.rend()) { 373 while (all_transmissions_it != all_transmissions.rend()) {
378 QuicPacketSequenceNumber previous_transmission = *all_transmissions_it; 374 QuicPacketSequenceNumber previous_transmission = *all_transmissions_it;
379 const TransmissionInfo& transmission_info =
380 unacked_packets_.GetTransmissionInfo(previous_transmission);
381 // If this packet was marked for retransmission, don't bother retransmitting 375 // If this packet was marked for retransmission, don't bother retransmitting
382 // it anymore. 376 // it anymore.
383 pending_retransmissions_.erase(previous_transmission); 377 pending_retransmissions_.erase(previous_transmission);
384 if (has_crypto_handshake) { 378 if (has_crypto_handshake) {
385 // If it's a crypto handshake packet, discard it and all retransmissions, 379 // If it's a crypto handshake packet, discard it and all retransmissions,
386 // since they won't be acked now that one has been processed. 380 // since they won't be acked now that one has been processed.
387 unacked_packets_.SetNotPending(previous_transmission); 381 unacked_packets_.SetNotPending(previous_transmission);
388 } 382 }
389 if (!transmission_info.pending) { 383 unacked_packets_.NeuterIfPendingOrRemovePacket(previous_transmission);
390 unacked_packets_.RemovePacket(previous_transmission);
391 } else {
392 unacked_packets_.NeuterPacket(previous_transmission);
393 }
394 ++all_transmissions_it; 384 ++all_transmissions_it;
395 } 385 }
396 386
397 QuicUnackedPacketMap::const_iterator next_unacked = unacked_packets_.begin(); 387 QuicUnackedPacketMap::const_iterator next_unacked = unacked_packets_.begin();
398 while (next_unacked != unacked_packets_.end() && 388 while (next_unacked != unacked_packets_.end() &&
399 next_unacked->first < sequence_number) { 389 next_unacked->first < sequence_number) {
400 ++next_unacked; 390 ++next_unacked;
401 } 391 }
402 return next_unacked; 392 return next_unacked;
403 } 393 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 packets_lost_[sequence_number] = transmission_info; 584 packets_lost_[sequence_number] = transmission_info;
595 unacked_packets_.SetNotPending(sequence_number); 585 unacked_packets_.SetNotPending(sequence_number);
596 586
597 if (transmission_info.retransmittable_frames != NULL) { 587 if (transmission_info.retransmittable_frames != NULL) {
598 MarkForRetransmission(sequence_number, LOSS_RETRANSMISSION); 588 MarkForRetransmission(sequence_number, LOSS_RETRANSMISSION);
599 } else { 589 } else {
600 // Since we will not retransmit this, we need to remove it from 590 // Since we will not retransmit this, we need to remove it from
601 // unacked_packets_. This is either the current transmission of 591 // unacked_packets_. This is either the current transmission of
602 // a packet whose previous transmission has been acked, or it 592 // a packet whose previous transmission has been acked, or it
603 // is a packet that has been TLP retransmitted. 593 // is a packet that has been TLP retransmitted.
604 unacked_packets_.RemovePacket(sequence_number); 594 unacked_packets_.NeuterIfPendingOrRemovePacket(sequence_number);
605 } 595 }
606 } 596 }
607 } 597 }
608 598
609 bool QuicSentPacketManager::MaybeUpdateRTT( 599 bool QuicSentPacketManager::MaybeUpdateRTT(
610 const ReceivedPacketInfo& received_info, 600 const ReceivedPacketInfo& received_info,
611 const QuicTime& ack_receive_time) { 601 const QuicTime& ack_receive_time) {
612 if (!unacked_packets_.IsUnacked(received_info.largest_observed)) { 602 if (!unacked_packets_.IsUnacked(received_info.largest_observed)) {
613 return false; 603 return false;
614 } 604 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 return; 746 return;
757 } 747 }
758 748
759 using_pacing_ = true; 749 using_pacing_ = true;
760 send_algorithm_.reset( 750 send_algorithm_.reset(
761 new PacingSender(send_algorithm_.release(), 751 new PacingSender(send_algorithm_.release(),
762 QuicTime::Delta::FromMicroseconds(1))); 752 QuicTime::Delta::FromMicroseconds(1)));
763 } 753 }
764 754
765 } // namespace net 755 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/tcp_loss_algorithm_test.cc ('k') | net/quic/quic_unacked_packet_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698