return the packet number length when peek a new packet number

This commit is contained in:
Marten Seemann 2018-11-01 17:09:47 +07:00
parent ebbf839fa4
commit c81cd92daf
7 changed files with 48 additions and 113 deletions

View file

@ -521,18 +521,15 @@ func (h *sentPacketHandler) DequeueProbePacket() (*Packet, error) {
return h.DequeuePacketForRetransmission(), nil
}
func (h *sentPacketHandler) PeekPacketNumber() protocol.PacketNumber {
return h.packetNumberGenerator.Peek()
func (h *sentPacketHandler) PeekPacketNumber() (protocol.PacketNumber, protocol.PacketNumberLen) {
pn := h.packetNumberGenerator.Peek()
return pn, protocol.GetPacketNumberLengthForHeader(pn, h.lowestUnacked(), h.version)
}
func (h *sentPacketHandler) PopPacketNumber() protocol.PacketNumber {
return h.packetNumberGenerator.Pop()
}
func (h *sentPacketHandler) GetPacketNumberLen(p protocol.PacketNumber) protocol.PacketNumberLen {
return protocol.GetPacketNumberLengthForHeader(p, h.lowestUnacked(), h.version)
}
func (h *sentPacketHandler) SendMode() SendMode {
numTrackedPackets := len(h.retransmissionQueue) + h.packetHistory.Len()