wire: save ECN counts on the ACK frame (#3829)

This commit is contained in:
Marten Seemann 2023-05-28 16:36:38 +03:00 committed by GitHub
parent 02013caaa4
commit 378e3c8b74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 5 deletions

View file

@ -90,13 +90,22 @@ func parseAckFrame(r *bytes.Reader, typ uint64, ackDelayExponent uint8, _ protoc
return nil, errInvalidAckRanges
}
// parse (and skip) the ECN section
if ecn {
for i := 0; i < 3; i++ {
if _, err := quicvarint.Read(r); err != nil {
return nil, err
}
ect0, err := quicvarint.Read(r)
if err != nil {
return nil, err
}
frame.ECT0 = ect0
ect1, err := quicvarint.Read(r)
if err != nil {
return nil, err
}
frame.ECT1 = ect1
ecnce, err := quicvarint.Read(r)
if err != nil {
return nil, err
}
frame.ECNCE = ecnce
}
return frame, nil

View file

@ -170,6 +170,9 @@ var _ = Describe("ACK Frame (for IETF QUIC)", func() {
Expect(frame.LargestAcked()).To(Equal(protocol.PacketNumber(100)))
Expect(frame.LowestAcked()).To(Equal(protocol.PacketNumber(90)))
Expect(frame.HasMissingRanges()).To(BeFalse())
Expect(frame.ECT0).To(BeEquivalentTo(0x42))
Expect(frame.ECT1).To(BeEquivalentTo(0x12345))
Expect(frame.ECNCE).To(BeEquivalentTo(0x12345678))
Expect(b.Len()).To(BeZero())
})