forked from quic-go/quic-go
save the max_ack_delay in the rttStats
This commit is contained in:
@@ -14,7 +14,6 @@ type SentPacketHandler interface {
|
||||
SentPacket(packet *Packet)
|
||||
SentPacketsAsRetransmission(packets []*Packet, retransmissionOf protocol.PacketNumber)
|
||||
ReceivedAck(ackFrame *wire.AckFrame, withPacketNumber protocol.PacketNumber, encLevel protocol.EncryptionLevel, recvTime time.Time) error
|
||||
SetMaxAckDelay(time.Duration)
|
||||
DropPackets(protocol.EncryptionLevel)
|
||||
ResetForRetry() error
|
||||
|
||||
|
||||
@@ -60,8 +60,6 @@ type sentPacketHandler struct {
|
||||
congestion congestion.SendAlgorithmWithDebugInfos
|
||||
rttStats *congestion.RTTStats
|
||||
|
||||
maxAckDelay time.Duration
|
||||
|
||||
// The number of times the crypto packets have been retransmitted without receiving an ack.
|
||||
cryptoCount uint32
|
||||
// The number of times a PTO has been sent without receiving an ack.
|
||||
@@ -135,10 +133,6 @@ func (h *sentPacketHandler) DropPackets(encLevel protocol.EncryptionLevel) {
|
||||
}
|
||||
}
|
||||
|
||||
func (h *sentPacketHandler) SetMaxAckDelay(mad time.Duration) {
|
||||
h.maxAckDelay = mad
|
||||
}
|
||||
|
||||
func (h *sentPacketHandler) SentPacket(packet *Packet) {
|
||||
if isAckEliciting := h.sentPacketImpl(packet); isAckEliciting {
|
||||
h.getPacketNumberSpace(packet.EncryptionLevel).history.SentPacket(packet)
|
||||
@@ -226,7 +220,7 @@ func (h *sentPacketHandler) ReceivedAck(ackFrame *wire.AckFrame, withPacketNumbe
|
||||
// don't use the ack delay for Initial and Handshake packets
|
||||
var ackDelay time.Duration
|
||||
if encLevel == protocol.Encryption1RTT {
|
||||
ackDelay = utils.MinDuration(ackFrame.DelayTime, h.maxAckDelay)
|
||||
ackDelay = utils.MinDuration(ackFrame.DelayTime, h.rttStats.MaxAckDelay())
|
||||
}
|
||||
h.rttStats.UpdateRTT(rcvTime.Sub(p.SendTime), ackDelay, rcvTime)
|
||||
if h.logger.Debug() {
|
||||
@@ -664,7 +658,7 @@ func (h *sentPacketHandler) computeCryptoTimeout() time.Duration {
|
||||
}
|
||||
|
||||
func (h *sentPacketHandler) computePTOTimeout() time.Duration {
|
||||
duration := h.rttStats.SmoothedOrInitialRTT() + utils.MaxDuration(4*h.rttStats.MeanDeviation(), protocol.TimerGranularity) + h.maxAckDelay
|
||||
duration := h.rttStats.SmoothedOrInitialRTT() + utils.MaxDuration(4*h.rttStats.MeanDeviation(), protocol.TimerGranularity) + h.rttStats.MaxAckDelay()
|
||||
return duration << h.ptoCount
|
||||
}
|
||||
|
||||
|
||||
@@ -293,7 +293,7 @@ var _ = Describe("SentPacketHandler", func() {
|
||||
|
||||
It("ignores the DelayTime for Initial and Handshake packets", func() {
|
||||
handler.SentPacket(cryptoPacket(&Packet{PacketNumber: 1}))
|
||||
handler.SetMaxAckDelay(time.Hour)
|
||||
handler.rttStats.SetMaxAckDelay(time.Hour)
|
||||
// make sure the rttStats have a min RTT, so that the delay is used
|
||||
handler.rttStats.UpdateRTT(5*time.Minute, 0, time.Now())
|
||||
getPacket(1, protocol.EncryptionInitial).SendTime = time.Now().Add(-10 * time.Minute)
|
||||
@@ -306,7 +306,7 @@ var _ = Describe("SentPacketHandler", func() {
|
||||
})
|
||||
|
||||
It("uses the DelayTime in the ACK frame", func() {
|
||||
handler.SetMaxAckDelay(time.Hour)
|
||||
handler.rttStats.SetMaxAckDelay(time.Hour)
|
||||
// make sure the rttStats have a min RTT, so that the delay is used
|
||||
handler.rttStats.UpdateRTT(5*time.Minute, 0, time.Now())
|
||||
getPacket(1, protocol.Encryption1RTT).SendTime = time.Now().Add(-10 * time.Minute)
|
||||
@@ -319,7 +319,7 @@ var _ = Describe("SentPacketHandler", func() {
|
||||
})
|
||||
|
||||
It("limits the DelayTime in the ACK frame to max_ack_delay", func() {
|
||||
handler.SetMaxAckDelay(time.Minute)
|
||||
handler.rttStats.SetMaxAckDelay(time.Minute)
|
||||
// make sure the rttStats have a min RTT, so that the delay is used
|
||||
handler.rttStats.UpdateRTT(5*time.Minute, 0, time.Now())
|
||||
getPacket(1, protocol.Encryption1RTT).SendTime = time.Now().Add(-10 * time.Minute)
|
||||
|
||||
Reference in New Issue
Block a user