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

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

Issue 1660533002: Landing Recent QUIC changes until 01/26/2016 18:14 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « net/quic/quic_protocol.cc ('k') | net/quic/quic_sent_packet_manager_test.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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 ++stats_->packets_spuriously_retransmitted; 407 ++stats_->packets_spuriously_retransmitted;
408 if (debug_delegate_ != nullptr) { 408 if (debug_delegate_ != nullptr) {
409 debug_delegate_->OnSpuriousPacketRetransmission(info.transmission_type, 409 debug_delegate_->OnSpuriousPacketRetransmission(info.transmission_type,
410 info.bytes_sent); 410 info.bytes_sent);
411 } 411 }
412 } 412 }
413 413
414 void QuicSentPacketManager::RecordSpuriousRetransmissions( 414 void QuicSentPacketManager::RecordSpuriousRetransmissions(
415 const TransmissionInfo& info, 415 const TransmissionInfo& info,
416 QuicPacketNumber acked_packet_number) { 416 QuicPacketNumber acked_packet_number) {
417 if (unacked_packets_.track_single_retransmission()) { 417 QuicPacketNumber retransmission = info.retransmission;
418 QuicPacketNumber retransmission = info.retransmission; 418 while (retransmission != 0) {
419 while (retransmission != 0) {
420 const TransmissionInfo& retransmit_info =
421 unacked_packets_.GetTransmissionInfo(retransmission);
422 retransmission = retransmit_info.retransmission;
423 RecordOneSpuriousRetransmission(retransmit_info);
424 }
425 return;
426 }
427 const PacketNumberList* all_transmissions = info.all_transmissions;
428 for (PacketNumberList::const_reverse_iterator it =
429 all_transmissions->rbegin();
430 it != all_transmissions->rend() && *it > acked_packet_number; ++it) {
431 // ianswett: Prevents crash in b/20552846.
432 if (*it < unacked_packets_.GetLeastUnacked() ||
433 *it > unacked_packets_.largest_sent_packet()) {
434 QUIC_BUG << "Retransmission out of range:" << *it
435 << " least unacked:" << unacked_packets_.GetLeastUnacked()
436 << " largest sent:" << unacked_packets_.largest_sent_packet();
437 return;
438 }
439 const TransmissionInfo& retransmit_info = 419 const TransmissionInfo& retransmit_info =
440 unacked_packets_.GetTransmissionInfo(*it); 420 unacked_packets_.GetTransmissionInfo(retransmission);
441 421 retransmission = retransmit_info.retransmission;
442 RecordOneSpuriousRetransmission(retransmit_info); 422 RecordOneSpuriousRetransmission(retransmit_info);
443 } 423 }
444 } 424 }
445 425
446 bool QuicSentPacketManager::HasPendingRetransmissions() const { 426 bool QuicSentPacketManager::HasPendingRetransmissions() const {
447 return !pending_retransmissions_.empty(); 427 return !pending_retransmissions_.empty();
448 } 428 }
449 429
450 PendingRetransmission QuicSentPacketManager::NextPendingRetransmission() { 430 PendingRetransmission QuicSentPacketManager::NextPendingRetransmission() {
451 QUIC_BUG_IF(pending_retransmissions_.empty()) 431 QUIC_BUG_IF(pending_retransmissions_.empty())
(...skipping 21 matching lines...) Expand all
473 transmission_info.retransmittable_frames, 453 transmission_info.retransmittable_frames,
474 transmission_info.has_crypto_handshake, 454 transmission_info.has_crypto_handshake,
475 transmission_info.needs_padding, 455 transmission_info.needs_padding,
476 transmission_info.encryption_level, 456 transmission_info.encryption_level,
477 transmission_info.packet_number_length); 457 transmission_info.packet_number_length);
478 } 458 }
479 459
480 QuicPacketNumber QuicSentPacketManager::GetNewestRetransmission( 460 QuicPacketNumber QuicSentPacketManager::GetNewestRetransmission(
481 QuicPacketNumber packet_number, 461 QuicPacketNumber packet_number,
482 const TransmissionInfo& transmission_info) const { 462 const TransmissionInfo& transmission_info) const {
483 if (unacked_packets_.track_single_retransmission()) { 463 QuicPacketNumber retransmission = transmission_info.retransmission;
484 QuicPacketNumber retransmission = transmission_info.retransmission; 464 while (retransmission != 0) {
485 while (retransmission != 0) { 465 packet_number = retransmission;
486 packet_number = retransmission; 466 retransmission =
487 retransmission = 467 unacked_packets_.GetTransmissionInfo(retransmission).retransmission;
488 unacked_packets_.GetTransmissionInfo(retransmission).retransmission;
489 }
490 return packet_number;
491 } else {
492 return transmission_info.all_transmissions == nullptr
493 ? packet_number
494 : *transmission_info.all_transmissions->rbegin();
495 } 468 }
469 return packet_number;
496 } 470 }
497 471
498 void QuicSentPacketManager::MarkPacketNotRetransmittable( 472 void QuicSentPacketManager::MarkPacketNotRetransmittable(
499 QuicPacketNumber packet_number, 473 QuicPacketNumber packet_number,
500 QuicTime::Delta ack_delay_time) { 474 QuicTime::Delta ack_delay_time) {
501 if (!unacked_packets_.IsUnacked(packet_number)) { 475 if (!unacked_packets_.IsUnacked(packet_number)) {
502 return; 476 return;
503 } 477 }
504 478
505 const TransmissionInfo& transmission_info = 479 const TransmissionInfo& transmission_info =
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked(); 674 QuicPacketNumber packet_number = unacked_packets_.GetLeastUnacked();
701 for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin(); 675 for (QuicUnackedPacketMap::const_iterator it = unacked_packets_.begin();
702 it != unacked_packets_.end(); ++it, ++packet_number) { 676 it != unacked_packets_.end(); ++it, ++packet_number) {
703 if (!it->retransmittable_frames.empty() && 677 if (!it->retransmittable_frames.empty() &&
704 pending_timer_transmission_count_ < kMaxRetransmissionsOnTimeout) { 678 pending_timer_transmission_count_ < kMaxRetransmissionsOnTimeout) {
705 MarkForRetransmission(packet_number, RTO_RETRANSMISSION); 679 MarkForRetransmission(packet_number, RTO_RETRANSMISSION);
706 ++pending_timer_transmission_count_; 680 ++pending_timer_transmission_count_;
707 } 681 }
708 // Abandon non-retransmittable data that's in flight to ensure it doesn't 682 // Abandon non-retransmittable data that's in flight to ensure it doesn't
709 // fill up the congestion window. 683 // fill up the congestion window.
710 const bool has_retransmissions = 684 const bool has_retransmissions = it->retransmission != 0;
711 unacked_packets_.track_single_retransmission()
712 ? it->retransmission != 0
713 : it->all_transmissions != nullptr;
714 if (it->retransmittable_frames.empty() && it->in_flight && 685 if (it->retransmittable_frames.empty() && it->in_flight &&
715 !has_retransmissions) { 686 !has_retransmissions) {
716 // Log only for non-retransmittable data. 687 // Log only for non-retransmittable data.
717 // Retransmittable data is marked as lost during loss detection, and will 688 // Retransmittable data is marked as lost during loss detection, and will
718 // be logged later. 689 // be logged later.
719 unacked_packets_.RemoveFromInFlight(packet_number); 690 unacked_packets_.RemoveFromInFlight(packet_number);
720 if (FLAGS_quic_log_loss_event && debug_delegate_ != nullptr) { 691 if (FLAGS_quic_log_loss_event && debug_delegate_ != nullptr) {
721 debug_delegate_->OnPacketLoss(packet_number, RTO_RETRANSMISSION, 692 debug_delegate_->OnPacketLoss(packet_number, RTO_RETRANSMISSION,
722 clock_->Now()); 693 clock_->Now());
723 } 694 }
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo( 1004 TransmissionInfo* QuicSentPacketManager::GetMutableTransmissionInfo(
1034 QuicPacketNumber packet_number) { 1005 QuicPacketNumber packet_number) {
1035 return unacked_packets_.GetMutableTransmissionInfo(packet_number); 1006 return unacked_packets_.GetMutableTransmissionInfo(packet_number);
1036 } 1007 }
1037 1008
1038 void QuicSentPacketManager::RemoveObsoletePackets() { 1009 void QuicSentPacketManager::RemoveObsoletePackets() {
1039 unacked_packets_.RemoveObsoletePackets(); 1010 unacked_packets_.RemoveObsoletePackets();
1040 } 1011 }
1041 1012
1042 } // namespace net 1013 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_protocol.cc ('k') | net/quic/quic_sent_packet_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698