remove the {Lowest, Largest}Acked from the ACK frame

All ACK ranges are now saved in the AckRanges slices. This eliminates a
bunch of special cases for ACKs that don't report any packets missing.
This commit is contained in:
Marten Seemann
2018-04-17 11:50:22 +09:00
parent 7de877fc3f
commit 52c3e6e863
15 changed files with 389 additions and 515 deletions

View File

@@ -91,7 +91,7 @@ func (h *receivedPacketHandler) isMissing(p protocol.PacketNumber) bool {
if h.lastAck == nil {
return false
}
return p < h.lastAck.LargestAcked && !h.lastAck.AcksPacket(p)
return p < h.lastAck.LargestAcked() && !h.lastAck.AcksPacket(p)
}
func (h *receivedPacketHandler) hasNewMissingPackets() bool {
@@ -99,7 +99,7 @@ func (h *receivedPacketHandler) hasNewMissingPackets() bool {
return false
}
highestRange := h.packetHistory.GetHighestAckRange()
return highestRange.Smallest >= h.lastAck.LargestAcked && highestRange.Len() <= maxPacketsAfterNewMissing
return highestRange.Smallest >= h.lastAck.LargestAcked() && highestRange.Len() <= maxPacketsAfterNewMissing
}
// maybeQueueAck queues an ACK, if necessary.
@@ -163,17 +163,11 @@ func (h *receivedPacketHandler) GetAckFrame() *wire.AckFrame {
return nil
}
ackRanges := h.packetHistory.GetAckRanges()
ack := &wire.AckFrame{
LargestAcked: h.largestObserved,
LowestAcked: ackRanges[len(ackRanges)-1].Smallest,
AckRanges: h.packetHistory.GetAckRanges(),
PacketReceivedTime: h.largestObservedReceivedTime,
}
if len(ackRanges) > 1 {
ack.AckRanges = ackRanges
}
h.lastAck = ack
h.ackAlarm = time.Time{}
h.ackQueued = false