mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 20:57:36 +03:00
move constants used by the received packet handler to ackhandler package
This commit is contained in:
parent
41d7cbb014
commit
8fc0f53a8d
3 changed files with 10 additions and 10 deletions
|
@ -25,11 +25,18 @@ type receivedPacketHandler struct {
|
|||
version protocol.VersionNumber
|
||||
}
|
||||
|
||||
const (
|
||||
// ackSendDelay is the maximum delay that can be applied to an ACK for a retransmittable packet
|
||||
ackSendDelay = 25 * time.Millisecond
|
||||
// retransmittablePacketsBeforeAck is the number of retransmittable that an ACK is sent for
|
||||
retransmittablePacketsBeforeAck = 10
|
||||
)
|
||||
|
||||
// NewReceivedPacketHandler creates a new receivedPacketHandler
|
||||
func NewReceivedPacketHandler(version protocol.VersionNumber) ReceivedPacketHandler {
|
||||
return &receivedPacketHandler{
|
||||
packetHistory: newReceivedPacketHistory(),
|
||||
ackSendDelay: protocol.AckSendDelay,
|
||||
ackSendDelay: ackSendDelay,
|
||||
version: version,
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +89,7 @@ func (h *receivedPacketHandler) maybeQueueAck(packetNumber protocol.PacketNumber
|
|||
}
|
||||
|
||||
if !h.ackQueued && shouldInstigateAck {
|
||||
if h.retransmittablePacketsReceivedSinceLastAck >= protocol.RetransmittablePacketsBeforeAck {
|
||||
if h.retransmittablePacketsReceivedSinceLastAck >= retransmittablePacketsBeforeAck {
|
||||
h.ackQueued = true
|
||||
} else {
|
||||
if h.ackAlarm.IsZero() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue