| Index: net/quic/quic_connection.cc
|
| diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
|
| index 1dd656ebaa0a3972ca5842c72bd20d044294903d..d8ab40f485128a3ce639f9d3beaf86d39eb3f127 100644
|
| --- a/net/quic/quic_connection.cc
|
| +++ b/net/quic/quic_connection.cc
|
| @@ -278,9 +278,10 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
|
| received_packet_manager_(&stats_),
|
| ack_queued_(false),
|
| num_retransmittable_packets_received_since_last_ack_sent_(0),
|
| + last_ack_had_missing_packets_(false),
|
| num_packets_received_since_last_ack_sent_(0),
|
| stop_waiting_count_(0),
|
| - ack_decimation_enabled_(false),
|
| + ack_mode_(TCP_ACKING),
|
| delay_setting_retransmission_alarm_(false),
|
| pending_retransmission_alarm_(false),
|
| arena_(),
|
| @@ -415,7 +416,11 @@ void QuicConnection::SetFromConfig(const QuicConfig& config) {
|
| debug_visitor_->OnSetFromConfig(config);
|
| }
|
| if (config.HasClientSentConnectionOption(kACKD, perspective_)) {
|
| - ack_decimation_enabled_ = true;
|
| + ack_mode_ = ACK_DECIMATION;
|
| + }
|
| + if (FLAGS_quic_ack_decimation2 &&
|
| + config.HasClientSentConnectionOption(kAKD2, perspective_)) {
|
| + ack_mode_ = ACK_DECIMATION_WITH_REORDERING;
|
| }
|
| }
|
|
|
| @@ -1033,13 +1038,16 @@ void QuicConnection::MaybeQueueAck(bool was_missing) {
|
|
|
| // Determine whether the newly received packet was missing before recording
|
| // the received packet.
|
| - if (was_missing) {
|
| + // Ack decimation with reordering relies on the timer to send an ack, but if
|
| + // missing packets we reported in the previous ack, send an ack immediately.
|
| + if (was_missing && (ack_mode_ != ACK_DECIMATION_WITH_REORDERING ||
|
| + last_ack_had_missing_packets_)) {
|
| ack_queued_ = true;
|
| }
|
|
|
| if (should_last_packet_instigate_acks_ && !ack_queued_) {
|
| ++num_retransmittable_packets_received_since_last_ack_sent_;
|
| - if (ack_decimation_enabled_ &&
|
| + if (ack_mode_ != TCP_ACKING &&
|
| last_header_.packet_number > kMinReceivedBeforeAckDecimation) {
|
| // Ack up to 10 packets at once.
|
| if (num_retransmittable_packets_received_since_last_ack_sent_ >=
|
| @@ -1064,10 +1072,18 @@ void QuicConnection::MaybeQueueAck(bool was_missing) {
|
| }
|
|
|
| // If there are new missing packets to report, send an ack immediately.
|
| - // TODO(ianswett): Consider allowing 1ms of reordering for the
|
| - // ack decimation experiment.
|
| if (received_packet_manager_.HasNewMissingPackets()) {
|
| - ack_queued_ = true;
|
| + if (ack_mode_ == ACK_DECIMATION_WITH_REORDERING) {
|
| + // Wait the minimum of an eighth min_rtt and the existing ack time.
|
| + QuicTime ack_time = clock_->ApproximateNow().Add(
|
| + sent_packet_manager_.GetRttStats()->min_rtt().Multiply(0.125));
|
| + if (!ack_alarm_->IsSet() || ack_alarm_->deadline() > ack_time) {
|
| + ack_alarm_->Cancel();
|
| + ack_alarm_->Set(ack_time);
|
| + }
|
| + } else {
|
| + ack_queued_ = true;
|
| + }
|
| }
|
| }
|
|
|
| @@ -1853,6 +1869,7 @@ void QuicConnection::SendAck() {
|
| ack_queued_ = false;
|
| stop_waiting_count_ = 0;
|
| num_retransmittable_packets_received_since_last_ack_sent_ = 0;
|
| + last_ack_had_missing_packets_ = received_packet_manager_.HasMissingPackets();
|
| num_packets_received_since_last_ack_sent_ = 0;
|
|
|
| packet_generator_.SetShouldSendAck(true);
|
|
|