forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
37 changed files
with
812 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_ |
Oops, something went wrong.