Skip to content

Commit

Permalink
Land Recent QUIC Changes.
Browse files Browse the repository at this point in the history
Report accurate header and body size from SimpleClient. Testing only.

Merge internal change: 56297351

Parse the QUIC header and packet sequence number in
QuicTimeWaitListManager to create a more compliant public reset packet.

Merge internal change: 56286980

Do not bundle ACKs with QUIC crypto messages.  We have DHCECKs in place
that fire when this happens, and so it "rarely" happens in practice.
However, in working on pacing, I discovered we can actually cause it to
happen.

Merge internal change: 56186837

Add a new PacingSender which can be used to add pacing on top of an
existing QUIC sender.

Merge internal change: 56183480

QUIC - minor cleanup change - fixed the include order to match internal
source code.


Preparation for exporting final CWND on GFE when QuicSession is closed.

Add accessor methods to expose congestion window (in bytes or packets)
to QuicConnection.

Merge internal change: 56178198

Changed end-to-end's MultiplePacketsRandomOrder unit test name match
internal code.

Merge internal change: 56174630

R=rch@chromium.org
BUG=

Review URL: https://codereview.chromium.org/61623011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235531 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
rtenneti@chromium.org committed Nov 17, 2013
1 parent 1735b68 commit ec86d54
Show file tree
Hide file tree
Showing 37 changed files with 812 additions and 183 deletions.
3 changes: 3 additions & 0 deletions net/net.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
'quic/congestion_control/leaky_bucket.h',
'quic/congestion_control/paced_sender.cc',
'quic/congestion_control/paced_sender.h',
'quic/congestion_control/pacing_sender.cc',
'quic/congestion_control/pacing_sender.h',
'quic/congestion_control/quic_congestion_manager.cc',
'quic/congestion_control/quic_congestion_manager.h',
'quic/congestion_control/quic_max_sized_map.h',
Expand Down Expand Up @@ -1744,6 +1746,7 @@
'quic/congestion_control/inter_arrival_sender_test.cc',
'quic/congestion_control/leaky_bucket_test.cc',
'quic/congestion_control/paced_sender_test.cc',
'quic/congestion_control/pacing_sender_test.cc',
'quic/congestion_control/quic_congestion_control_test.cc',
'quic/congestion_control/quic_congestion_manager_test.cc',
'quic/congestion_control/quic_max_sized_map_test.cc',
Expand Down
2 changes: 1 addition & 1 deletion net/quic/congestion_control/fix_rate_sender.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ QuicTime::Delta FixRateSender::RetransmissionDelay() {
return latest_rtt_.Add(latest_rtt_);
}

QuicByteCount FixRateSender::GetCongestionWindow() {
QuicByteCount FixRateSender::GetCongestionWindow() const {
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion net/quic/congestion_control/fix_rate_sender.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class NET_EXPORT_PRIVATE FixRateSender : public SendAlgorithmInterface {
virtual QuicBandwidth BandwidthEstimate() OVERRIDE;
virtual QuicTime::Delta SmoothedRtt() OVERRIDE;
virtual QuicTime::Delta RetransmissionDelay() OVERRIDE;
virtual QuicByteCount GetCongestionWindow() OVERRIDE;
virtual QuicByteCount GetCongestionWindow() const OVERRIDE;
virtual void SetCongestionWindow(QuicByteCount window) OVERRIDE;
// End implementation of SendAlgorithmInterface.

Expand Down
2 changes: 1 addition & 1 deletion net/quic/congestion_control/inter_arrival_sender.cc
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ QuicTime::Delta InterArrivalSender::RetransmissionDelay() {
return smoothed_rtt_.Add(smoothed_rtt_);
}

QuicByteCount InterArrivalSender::GetCongestionWindow() {
QuicByteCount InterArrivalSender::GetCongestionWindow() const {
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion net/quic/congestion_control/inter_arrival_sender.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class NET_EXPORT_PRIVATE InterArrivalSender : public SendAlgorithmInterface {
virtual QuicBandwidth BandwidthEstimate() OVERRIDE;
virtual QuicTime::Delta SmoothedRtt() OVERRIDE;
virtual QuicTime::Delta RetransmissionDelay() OVERRIDE;
virtual QuicByteCount GetCongestionWindow() OVERRIDE;
virtual QuicByteCount GetCongestionWindow() const OVERRIDE;
virtual void SetCongestionWindow(QuicByteCount window) OVERRIDE;
// End implementation of SendAlgorithmInterface.

Expand Down
3 changes: 2 additions & 1 deletion net/quic/congestion_control/inter_arrival_sender_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/quic/congestion_control/inter_arrival_sender.h"

#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/stl_util.h"
#include "net/quic/congestion_control/inter_arrival_sender.h"
#include "net/quic/test_tools/mock_clock.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand Down
117 changes: 117 additions & 0 deletions net/quic/congestion_control/pacing_sender.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/quic/congestion_control/pacing_sender.h"

namespace net {

PacingSender::PacingSender(SendAlgorithmInterface* sender,
QuicTime::Delta alarm_granularity)
: sender_(sender),
alarm_granularity_(alarm_granularity),
next_packet_send_time_(QuicTime::Zero()),
was_last_send_delayed_(false),
max_segment_size_(kDefaultMaxPacketSize) {
}

PacingSender::~PacingSender() {}

void PacingSender::SetFromConfig(const QuicConfig& config, bool is_server) {
max_segment_size_ = config.server_max_packet_size();
sender_->SetFromConfig(config, is_server);
}

void PacingSender::OnIncomingQuicCongestionFeedbackFrame(
const QuicCongestionFeedbackFrame& feedback,
QuicTime feedback_receive_time,
const SendAlgorithmInterface::SentPacketsMap& sent_packets) {
sender_->OnIncomingQuicCongestionFeedbackFrame(
feedback, feedback_receive_time, sent_packets);
}

void PacingSender::OnIncomingAck(
QuicPacketSequenceNumber acked_sequence_number,
QuicByteCount acked_bytes,
QuicTime::Delta rtt) {
sender_->OnIncomingAck(acked_sequence_number, acked_bytes, rtt);
}

void PacingSender::OnIncomingLoss(QuicPacketSequenceNumber largest_loss,
QuicTime ack_receive_time) {
sender_->OnIncomingLoss(largest_loss, ack_receive_time);
}

bool PacingSender::OnPacketSent(QuicTime sent_time,
QuicPacketSequenceNumber sequence_number,
QuicByteCount bytes,
TransmissionType transmission_type,
HasRetransmittableData is_retransmittable) {
// The next packet should be sent as soon as the current packets has
// been transferred.
next_packet_send_time_ =
next_packet_send_time_.Add(BandwidthEstimate().TransferTime(bytes));
return sender_->OnPacketSent(sent_time, sequence_number, bytes,
transmission_type, is_retransmittable);
}

void PacingSender::OnPacketAbandoned(QuicPacketSequenceNumber sequence_number,
QuicByteCount abandoned_bytes) {
sender_->OnPacketAbandoned(sequence_number, abandoned_bytes);
}

QuicTime::Delta PacingSender::TimeUntilSend(
QuicTime now,
TransmissionType transmission_type,
HasRetransmittableData has_retransmittable_data,
IsHandshake handshake) {
QuicTime::Delta time_until_send =
sender_->TimeUntilSend(now, transmission_type,
has_retransmittable_data, handshake);
if (!time_until_send.IsZero()) {
DCHECK(time_until_send.IsInfinite());
// The underlying sender prevents sending.
return time_until_send;
}

if (!was_last_send_delayed_ &&
(!next_packet_send_time_.IsInitialized() ||
now > next_packet_send_time_.Add(alarm_granularity_))) {
// An alarm did not go off late, instead the application is "slow"
// delivering data. In this case, we restrict the amount of lost time
// that we can make up for.
next_packet_send_time_ = now.Subtract(alarm_granularity_);
}

// If the end of the epoch is far enough in the future, delay the send.
if (next_packet_send_time_ > now.Add(alarm_granularity_)) {
was_last_send_delayed_ = true;
return next_packet_send_time_.Subtract(now);
}

// Sent it immediately. The epoch end will be adjusted in OnPacketSent.
was_last_send_delayed_ = false;
return QuicTime::Delta::Zero();
}

QuicBandwidth PacingSender::BandwidthEstimate() {
return sender_->BandwidthEstimate();
}

QuicTime::Delta PacingSender::SmoothedRtt() {
return sender_->SmoothedRtt();
}

QuicTime::Delta PacingSender::RetransmissionDelay() {
return sender_->RetransmissionDelay();
}

QuicByteCount PacingSender::GetCongestionWindow() const {
return sender_->GetCongestionWindow();
}

void PacingSender::SetCongestionWindow(QuicByteCount window) {
sender_->SetCongestionWindow(window);
}

} // namespace net
76 changes: 76 additions & 0 deletions net/quic/congestion_control/pacing_sender.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// A send algorithm which adds pacing on top of an another send algorithm.
// It uses the underlying sender's bandwidth estimate to determine the
// pacing rate to be used. It also takes into consideration the expected
// resolution of the underlying alarm mechanism to ensure that alarms are
// not set too aggressively, and to smooth out variations.

#ifndef NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_
#define NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_

#include <map>

#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "net/quic/congestion_control/send_algorithm_interface.h"
#include "net/quic/quic_bandwidth.h"
#include "net/quic/quic_clock.h"
#include "net/quic/quic_config.h"
#include "net/quic/quic_protocol.h"
#include "net/quic/quic_time.h"

namespace net {

class NET_EXPORT_PRIVATE PacingSender : public SendAlgorithmInterface {
public:
PacingSender(SendAlgorithmInterface* sender,
QuicTime::Delta alarm_granularity);
virtual ~PacingSender();

// SendAlgorithmInterface methods.
virtual void SetFromConfig(const QuicConfig& config, bool is_server) OVERRIDE;
virtual void OnIncomingQuicCongestionFeedbackFrame(
const QuicCongestionFeedbackFrame& feedback,
QuicTime feedback_receive_time,
const SendAlgorithmInterface::SentPacketsMap& sent_packets) OVERRIDE;
virtual void OnIncomingAck(QuicPacketSequenceNumber acked_sequence_number,
QuicByteCount acked_bytes,
QuicTime::Delta rtt) OVERRIDE;
virtual void OnIncomingLoss(QuicPacketSequenceNumber largest_loss,
QuicTime ack_receive_time) OVERRIDE;
virtual bool OnPacketSent(QuicTime sent_time,
QuicPacketSequenceNumber sequence_number,
QuicByteCount bytes,
TransmissionType transmission_type,
HasRetransmittableData is_retransmittable) OVERRIDE;
virtual void OnPacketAbandoned(QuicPacketSequenceNumber sequence_number,
QuicByteCount abandoned_bytes) OVERRIDE;
virtual QuicTime::Delta TimeUntilSend(
QuicTime now,
TransmissionType transmission_type,
HasRetransmittableData has_retransmittable_data,
IsHandshake handshake) OVERRIDE;
virtual QuicBandwidth BandwidthEstimate() OVERRIDE;
virtual QuicTime::Delta SmoothedRtt() OVERRIDE;
virtual QuicTime::Delta RetransmissionDelay() OVERRIDE;
virtual QuicByteCount GetCongestionWindow() const OVERRIDE;
virtual void SetCongestionWindow(QuicByteCount window) OVERRIDE;

private:
QuicTime::Delta GetTransferTime(QuicByteCount bytes);

scoped_ptr<SendAlgorithmInterface> sender_; // Underlying sender.
QuicTime::Delta alarm_granularity_;
QuicTime next_packet_send_time_; // When can the next packet be sent.
bool was_last_send_delayed_; // True when the last send was delayed.
QuicByteCount max_segment_size_;

DISALLOW_COPY_AND_ASSIGN(PacingSender);
};

} // namespace net

#endif // NET_QUIC_CONGESTION_CONTROL_PACING_SENDER_H_
Loading

0 comments on commit ec86d54

Please sign in to comment.