forked from quic-go/quic-go
Merge pull request #1228 from lucas-clemente/sent-packet-handler-packet-number-len
calculate the packet number length in the sent packet handler
This commit is contained in:
@@ -32,7 +32,7 @@ type SentPacketHandler interface {
|
||||
GetStopWaitingFrame(force bool) *wire.StopWaitingFrame
|
||||
GetLowestPacketNotConfirmedAcked() protocol.PacketNumber
|
||||
DequeuePacketForRetransmission() (packet *Packet)
|
||||
GetLeastUnacked() protocol.PacketNumber
|
||||
GetPacketNumberLen(protocol.PacketNumber) protocol.PacketNumberLen
|
||||
|
||||
GetAlarmTimeout() time.Time
|
||||
OnAlarm()
|
||||
|
||||
@@ -349,8 +349,8 @@ func (h *sentPacketHandler) DequeuePacketForRetransmission() *Packet {
|
||||
return packet
|
||||
}
|
||||
|
||||
func (h *sentPacketHandler) GetLeastUnacked() protocol.PacketNumber {
|
||||
return h.lowestUnacked()
|
||||
func (h *sentPacketHandler) GetPacketNumberLen(p protocol.PacketNumber) protocol.PacketNumberLen {
|
||||
return protocol.GetPacketNumberLengthForHeader(p, h.lowestUnacked())
|
||||
}
|
||||
|
||||
func (h *sentPacketHandler) GetStopWaitingFrame(force bool) *wire.StopWaitingFrame {
|
||||
|
||||
@@ -59,9 +59,10 @@ var _ = Describe("SentPacketHandler", func() {
|
||||
return nil
|
||||
}
|
||||
|
||||
It("gets the LeastUnacked packet number", func() {
|
||||
It("determines the packet number length", func() {
|
||||
handler.largestAcked = 0x1337
|
||||
Expect(handler.GetLeastUnacked()).To(Equal(protocol.PacketNumber(0x1337 + 1)))
|
||||
Expect(handler.GetPacketNumberLen(0x1338)).To(Equal(protocol.PacketNumberLen2))
|
||||
Expect(handler.GetPacketNumberLen(0xfffffff)).To(Equal(protocol.PacketNumberLen4))
|
||||
})
|
||||
|
||||
Context("registering sent packets", func() {
|
||||
|
||||
Reference in New Issue
Block a user