add an assertion that bytes_in_flight never becomes negative

This commit is contained in:
Marten Seemann
2020-09-14 10:32:32 +07:00
parent 8bf5c782e3
commit 3ef77b0c1a

View File

@@ -133,6 +133,9 @@ func (h *sentPacketHandler) DropPackets(encLevel protocol.EncryptionLevel) {
func (h *sentPacketHandler) removeFromBytesInFlight(p *Packet) {
if p.includedInBytesInFlight {
if p.Length > h.bytesInFlight {
panic("negative bytes_in_flight")
}
h.bytesInFlight -= p.Length
p.includedInBytesInFlight = false
}