mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
include the timer granularity in the advertised max_ack_delay
This commit is contained in:
parent
af8c03ebaf
commit
6c27967c8a
5 changed files with 14 additions and 8 deletions
|
@ -352,7 +352,7 @@ func (c *client) createNewTLSSession(version protocol.VersionNumber) error {
|
|||
IdleTimeout: c.config.IdleTimeout,
|
||||
MaxBidiStreams: uint64(c.config.MaxIncomingStreams),
|
||||
MaxUniStreams: uint64(c.config.MaxIncomingUniStreams),
|
||||
MaxAckDelay: protocol.MaxAckDelay,
|
||||
MaxAckDelay: protocol.MaxAckDelayInclGranularity,
|
||||
AckDelayExponent: protocol.AckDelayExponent,
|
||||
DisableMigration: true,
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@ const (
|
|||
// Maximum reordering in time space before time based loss detection considers a packet lost.
|
||||
// Specified as an RTT multiplier.
|
||||
timeThreshold = 9.0 / 8
|
||||
// Timer granularity. The timer will not be set to a value smaller than granularity.
|
||||
granularity = time.Millisecond
|
||||
)
|
||||
|
||||
type packetNumberSpace struct {
|
||||
|
@ -341,7 +339,7 @@ func (h *sentPacketHandler) detectLostPackets(
|
|||
lossDelay := time.Duration(timeThreshold * maxRTT)
|
||||
|
||||
// Minimum time of granularity before packets are deemed lost.
|
||||
lossDelay = utils.MaxDuration(lossDelay, granularity)
|
||||
lossDelay = utils.MaxDuration(lossDelay, protocol.TimerGranularity)
|
||||
|
||||
var lostPackets []*Packet
|
||||
pnSpace.history.Iterate(func(packet *Packet) (bool, error) {
|
||||
|
@ -616,7 +614,7 @@ func (h *sentPacketHandler) queuePacketForRetransmission(p *Packet, pnSpace *pac
|
|||
}
|
||||
|
||||
func (h *sentPacketHandler) computeCryptoTimeout() time.Duration {
|
||||
duration := utils.MaxDuration(2*h.rttStats.SmoothedOrInitialRTT(), granularity)
|
||||
duration := utils.MaxDuration(2*h.rttStats.SmoothedOrInitialRTT(), protocol.TimerGranularity)
|
||||
// exponential backoff
|
||||
// There's an implicit limit to this set by the crypto timeout.
|
||||
return duration << h.cryptoCount
|
||||
|
@ -624,7 +622,7 @@ func (h *sentPacketHandler) computeCryptoTimeout() time.Duration {
|
|||
|
||||
func (h *sentPacketHandler) computePTOTimeout() time.Duration {
|
||||
// TODO(#1236): include the max_ack_delay
|
||||
duration := utils.MaxDuration(h.rttStats.SmoothedOrInitialRTT()+4*h.rttStats.MeanDeviation(), granularity)
|
||||
duration := utils.MaxDuration(h.rttStats.SmoothedOrInitialRTT()+4*h.rttStats.MeanDeviation(), protocol.TimerGranularity)
|
||||
return duration << h.ptoCount
|
||||
}
|
||||
|
||||
|
|
|
@ -593,7 +593,7 @@ var _ = Describe("SentPacketHandler", func() {
|
|||
It("uses the granularity for short RTTs", func() {
|
||||
rtt := time.Microsecond
|
||||
updateRTT(rtt)
|
||||
Expect(handler.computePTOTimeout()).To(Equal(granularity))
|
||||
Expect(handler.computePTOTimeout()).To(Equal(protocol.TimerGranularity))
|
||||
})
|
||||
|
||||
It("implements exponential backoff", func() {
|
||||
|
|
|
@ -126,5 +126,13 @@ const DefaultConnectionIDLength = 4
|
|||
// AckDelayExponent is the ack delay exponent used when sending ACKs.
|
||||
const AckDelayExponent = 3
|
||||
|
||||
// Estimated timer granularity.
|
||||
// The loss detection timer will not be set to a value smaller than granularity.
|
||||
const TimerGranularity = time.Millisecond
|
||||
|
||||
// MaxAckDelay is the maximum time by which we delay sending ACKs.
|
||||
const MaxAckDelay = 25 * time.Millisecond
|
||||
|
||||
// MaxAckDelayInclGranularity is the max_ack_delay including the timer granularity.
|
||||
// This is the value that should be advertised to the peer.
|
||||
const MaxAckDelayInclGranularity = MaxAckDelay + TimerGranularity
|
||||
|
|
|
@ -445,7 +445,7 @@ func (s *server) createNewSession(
|
|||
IdleTimeout: s.config.IdleTimeout,
|
||||
MaxBidiStreams: uint64(s.config.MaxIncomingStreams),
|
||||
MaxUniStreams: uint64(s.config.MaxIncomingUniStreams),
|
||||
MaxAckDelay: protocol.MaxAckDelay,
|
||||
MaxAckDelay: protocol.MaxAckDelayInclGranularity,
|
||||
AckDelayExponent: protocol.AckDelayExponent,
|
||||
DisableMigration: true,
|
||||
StatelessResetToken: &token,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue