public:
explicit HybridSlowStart(const QuicClock* clock);
+ void OnPacketAcked(QuicPacketSequenceNumber acked_sequence_number,
+ bool in_slow_start);
+
+ void OnPacketSent(QuicPacketSequenceNumber sequence_number);
+
+ // ShouldExitSlowStart should be called on every new ack frame, since a new
+ // RTT measurement can be made then.
+ // rtt: the RTT for this ack packet.
+ // min_rtt: is the lowest delay (RTT) we have seen during the session.
+ // congestion_window: the congestion window in packets.
+ bool ShouldExitSlowStart(QuicTime::Delta rtt,
+ QuicTime::Delta min_rtt,
+ int64 congestion_window);
+
// Start a new slow start phase.
void Restart();
+ // TODO(ianswett): The following methods should be private, but that requires
+ // a follow up CL to update the unit test.
// Returns true if this ack the last sequence number of our current slow start
// round.
// Call Reset if this returns true.
- bool EndOfRound(QuicPacketSequenceNumber ack);
-
- // Call for each round (burst) in the slow start phase.
- void Reset(QuicPacketSequenceNumber end_sequence_number);
+ bool IsEndOfRound(QuicPacketSequenceNumber ack) const;
- // rtt: it the RTT for this ack packet.
- // delay_min: is the lowest delay (RTT) we have seen during the session.
- void Update(QuicTime::Delta rtt, QuicTime::Delta delay_min);
+ // Call for the start of each receive round (burst) in the slow start phase.
+ void StartReceiveRound(QuicPacketSequenceNumber last_sent);
- // Returns true when we should exit slow start.
- bool Exit();
-
- bool started() { return started_; }
+ // Whether slow start has started.
+ bool started() const {
+ return started_;
+ }
private:
+ // Whether a condition for exiting slow start has been found.
+ enum HystartState {
+ NOT_FOUND,
+ ACK_TRAIN, // A closely spaced ack train is too long.
+ DELAY, // Too much increase in the round's min_rtt was observed.
+ };
+
const QuicClock* clock_;
+ // Whether the hybrid slow start has been started.
bool started_;
- bool found_ack_train_;
- bool found_delay_;
- QuicTime round_start_; // Beginning of each slow start round.
- QuicPacketSequenceNumber end_sequence_number_; // End of slow start round.
- QuicTime last_time_; // Last time when the ACK spacing was close.
- uint8 sample_count_; // Number of samples to decide current RTT.
- QuicTime::Delta current_rtt_; // The minimum rtt of current round.
+ HystartState hystart_found_;
+ // Last sequence number sent which was CWND limited.
+ QuicPacketSequenceNumber last_sent_sequence_number_;
+
+ // Variables for tracking acks received during a slow start round.
+ QuicTime round_start_; // Beginning of each slow start receive round.
+ QuicPacketSequenceNumber end_sequence_number_; // End of the receive round.
+ // Last time when the spacing between ack arrivals was less than 2 ms.
+ // Defaults to the beginning of the round.
+ QuicTime last_close_ack_pair_time_;
+ uint32 rtt_sample_count_; // Number of rtt samples in the current round.
+ QuicTime::Delta current_min_rtt_; // The minimum rtt of current round.
DISALLOW_COPY_AND_ASSIGN(HybridSlowStart);
};