mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-05 13:17:36 +03:00
fix reading of multiple-byte missingPacketSequenceNumberDeltas in AckFrame parsing
This commit is contained in:
parent
daa0fe86bd
commit
b084faff88
2 changed files with 17 additions and 6 deletions
|
@ -64,7 +64,6 @@ func ParseAckFrame(r *bytes.Reader) (*AckFrame, error) {
|
|||
if missingSequenceNumberDeltaLen == 0 {
|
||||
missingSequenceNumberDeltaLen = 1
|
||||
}
|
||||
_ = missingSequenceNumberDeltaLen
|
||||
|
||||
frame.Entropy, err = r.ReadByte()
|
||||
if err != nil {
|
||||
|
@ -120,28 +119,28 @@ func ParseAckFrame(r *bytes.Reader) (*AckFrame, error) {
|
|||
}
|
||||
|
||||
for i := uint8(0); i < numRanges; i++ {
|
||||
missingPacketSequenceNumberDeltaByte, err := r.ReadByte()
|
||||
missingPacketSequenceNumberDelta, err := utils.ReadUintN(r, missingSequenceNumberDeltaLen)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
missingPacketSequenceNumberDelta := uint64(missingPacketSequenceNumberDeltaByte)
|
||||
|
||||
rangeLength, err := utils.ReadUintN(r, largestObservedLen)
|
||||
rangeLengthByte, err := r.ReadByte()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rangeLength := uint8(rangeLengthByte)
|
||||
|
||||
nackRange := ackhandler.NackRange{
|
||||
Length: uint8(rangeLength + 1),
|
||||
}
|
||||
if i == 0 {
|
||||
nackRange.FirstPacketNumber = frame.LargestObserved - protocol.PacketNumber(missingPacketSequenceNumberDelta+rangeLength)
|
||||
nackRange.FirstPacketNumber = frame.LargestObserved - protocol.PacketNumber(missingPacketSequenceNumberDelta+uint64(rangeLength))
|
||||
} else {
|
||||
if missingPacketSequenceNumberDelta == 0 {
|
||||
return nil, errors.New("ACK frame: Continues NACK ranges not yet implemented.")
|
||||
}
|
||||
lastNackRange := frame.NackRanges[len(frame.NackRanges)-1]
|
||||
nackRange.FirstPacketNumber = lastNackRange.FirstPacketNumber - protocol.PacketNumber(missingPacketSequenceNumberDelta+rangeLength) - 1
|
||||
nackRange.FirstPacketNumber = lastNackRange.FirstPacketNumber - protocol.PacketNumber(missingPacketSequenceNumberDelta+uint64(rangeLength)) - 1
|
||||
}
|
||||
frame.NackRanges = append(frame.NackRanges, &nackRange)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue