| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/core/congestion_control/bbr_sender.h" | 5 #include "net/quic/core/congestion_control/bbr_sender.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "net/quic/core/congestion_control/rtt_stats.h" | 10 #include "net/quic/core/congestion_control/rtt_stats.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 // Exit recovery when there are no losses for a round. | 526 // Exit recovery when there are no losses for a round. |
| 527 if (has_losses) { | 527 if (has_losses) { |
| 528 end_recovery_at_ = last_sent_packet_; | 528 end_recovery_at_ = last_sent_packet_; |
| 529 } | 529 } |
| 530 | 530 |
| 531 switch (recovery_state_) { | 531 switch (recovery_state_) { |
| 532 case NOT_IN_RECOVERY: | 532 case NOT_IN_RECOVERY: |
| 533 // Enter conservation on the first loss. | 533 // Enter conservation on the first loss. |
| 534 if (has_losses) { | 534 if (has_losses) { |
| 535 recovery_state_ = CONSERVATION; | 535 recovery_state_ = CONSERVATION; |
| 536 if (FLAGS_quic_reloadable_flag_quic_bbr_fix_conservation || | 536 if (FLAGS_quic_reloadable_flag_quic_bbr_fix_conservation2) { |
| 537 FLAGS_quic_reloadable_flag_quic_bbr_fix_conservation2) { | |
| 538 // This will cause the |recovery_window_| to be set to the correct | 537 // This will cause the |recovery_window_| to be set to the correct |
| 539 // value in CalculateRecoveryWindow(). | 538 // value in CalculateRecoveryWindow(). |
| 540 recovery_window_ = 0; | 539 recovery_window_ = 0; |
| 541 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_bbr_fix_conservation, 1, | |
| 542 3); | |
| 543 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_bbr_fix_conservation2, 1, | 540 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_bbr_fix_conservation2, 1, |
| 544 3); | 541 3); |
| 545 } | 542 } |
| 546 // Since the conservation phase is meant to be lasting for a whole | 543 // Since the conservation phase is meant to be lasting for a whole |
| 547 // round, extend the current round as if it were started right now. | 544 // round, extend the current round as if it were started right now. |
| 548 current_round_trip_end_ = last_sent_packet_; | 545 current_round_trip_end_ = last_sent_packet_; |
| 549 } | 546 } |
| 550 break; | 547 break; |
| 551 | 548 |
| 552 case CONSERVATION: | 549 case CONSERVATION: |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 // Sanity checks. Ensure that we always allow to send at least | 728 // Sanity checks. Ensure that we always allow to send at least |
| 732 // |bytes_acked| in response. | 729 // |bytes_acked| in response. |
| 733 recovery_window_ = std::max( | 730 recovery_window_ = std::max( |
| 734 recovery_window_, unacked_packets_->bytes_in_flight() + bytes_acked); | 731 recovery_window_, unacked_packets_->bytes_in_flight() + bytes_acked); |
| 735 recovery_window_ = std::max(kMinimumCongestionWindow, recovery_window_); | 732 recovery_window_ = std::max(kMinimumCongestionWindow, recovery_window_); |
| 736 return; | 733 return; |
| 737 } | 734 } |
| 738 | 735 |
| 739 switch (recovery_state_) { | 736 switch (recovery_state_) { |
| 740 case CONSERVATION: | 737 case CONSERVATION: |
| 741 if (FLAGS_quic_reloadable_flag_quic_bbr_fix_conservation) { | 738 recovery_window_ = unacked_packets_->bytes_in_flight() + bytes_acked; |
| 742 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_bbr_fix_conservation, 2, 3); | |
| 743 recovery_window_ = | |
| 744 std::max(unacked_packets_->bytes_in_flight() + bytes_acked, | |
| 745 recovery_window_); | |
| 746 } else { | |
| 747 recovery_window_ = unacked_packets_->bytes_in_flight() + bytes_acked; | |
| 748 } | |
| 749 break; | 739 break; |
| 750 case GROWTH: | 740 case GROWTH: |
| 751 if (FLAGS_quic_reloadable_flag_quic_bbr_fix_conservation) { | 741 recovery_window_ = unacked_packets_->bytes_in_flight() + 2 * bytes_acked; |
| 752 QUIC_FLAG_COUNT_N(quic_reloadable_flag_quic_bbr_fix_conservation, 3, 3); | |
| 753 recovery_window_ = | |
| 754 std::max(unacked_packets_->bytes_in_flight() + 2 * bytes_acked, | |
| 755 recovery_window_ + bytes_acked); | |
| 756 } else { | |
| 757 recovery_window_ = | |
| 758 unacked_packets_->bytes_in_flight() + 2 * bytes_acked; | |
| 759 } | |
| 760 break; | 742 break; |
| 761 default: | 743 default: |
| 762 break; | 744 break; |
| 763 } | 745 } |
| 764 recovery_window_ = std::max(kMinimumCongestionWindow, recovery_window_); | 746 recovery_window_ = std::max(kMinimumCongestionWindow, recovery_window_); |
| 765 } | 747 } |
| 766 | 748 |
| 767 std::string BbrSender::GetDebugState() const { | 749 std::string BbrSender::GetDebugState() const { |
| 768 std::ostringstream stream; | 750 std::ostringstream stream; |
| 769 stream << ExportDebugState(); | 751 stream << ExportDebugState(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 os << "Minimum RTT timestamp: " << state.min_rtt_timestamp.ToDebuggingValue() | 805 os << "Minimum RTT timestamp: " << state.min_rtt_timestamp.ToDebuggingValue() |
| 824 << std::endl; | 806 << std::endl; |
| 825 | 807 |
| 826 os << "Last sample is app-limited: " | 808 os << "Last sample is app-limited: " |
| 827 << (state.last_sample_is_app_limited ? "yes" : "no"); | 809 << (state.last_sample_is_app_limited ? "yes" : "no"); |
| 828 | 810 |
| 829 return os; | 811 return os; |
| 830 } | 812 } |
| 831 | 813 |
| 832 } // namespace net | 814 } // namespace net |
| OLD | NEW |