mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 20:57:36 +03:00
parent
3c7872c7b3
commit
295f6c78d9
2 changed files with 16 additions and 2 deletions
|
@ -83,7 +83,7 @@ func ParseAckFrame(r *bytes.Reader, version protocol.VersionNumber) (*AckFrame,
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if ackBlockLength < 1 {
|
||||
if frame.LargestAcked > 0 && ackBlockLength < 1 {
|
||||
return nil, ErrInvalidFirstAckRange
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,11 @@ func ParseAckFrame(r *bytes.Reader, version protocol.VersionNumber) (*AckFrame,
|
|||
|
||||
frame.LowestAcked = frame.AckRanges[len(frame.AckRanges)-1].FirstPacketNumber
|
||||
} else {
|
||||
frame.LowestAcked = protocol.PacketNumber(largestAcked + 1 - ackBlockLength)
|
||||
if frame.LargestAcked == 0 {
|
||||
frame.LowestAcked = 0
|
||||
} else {
|
||||
frame.LowestAcked = protocol.PacketNumber(largestAcked + 1 - ackBlockLength)
|
||||
}
|
||||
}
|
||||
|
||||
if !frame.validateAckRanges() {
|
||||
|
|
|
@ -29,6 +29,16 @@ var _ = Describe("AckFrame", func() {
|
|||
Expect(frame.LargestAcked).To(Equal(protocol.PacketNumber(3)))
|
||||
})
|
||||
|
||||
It("parses a frame where the largest acked is 0", func() {
|
||||
b := bytes.NewReader([]byte{0x40, 0x0, 0xff, 0xff, 0x0, 0x0})
|
||||
frame, err := ParseAckFrame(b, 0)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(frame.LargestAcked).To(Equal(protocol.PacketNumber(0)))
|
||||
Expect(frame.LowestAcked).To(Equal(protocol.PacketNumber(0)))
|
||||
Expect(frame.HasMissingRanges()).To(BeFalse())
|
||||
Expect(b.Len()).To(BeZero())
|
||||
})
|
||||
|
||||
It("parses a frame with a 48 bit packet number", func() {
|
||||
b := bytes.NewReader([]byte{0x4c, 0x37, 0x13, 0xad, 0xfb, 0xca, 0xde, 0x0, 0x0, 0x5, 0x1, 0, 0, 0, 0, 0})
|
||||
frame, err := ParseAckFrame(b, 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue