forked from quic-go/quic-go
ackhandler: remove the packet list element from the correct list
This commit is contained in:
@@ -108,8 +108,7 @@ func (h *sentPacketHistory) Remove(p protocol.PacketNumber) error {
|
||||
if !ok {
|
||||
return fmt.Errorf("packet %d not found in sent packet history", p)
|
||||
}
|
||||
h.outstandingPacketList.Remove(el)
|
||||
h.etcPacketList.Remove(el)
|
||||
el.List().Remove(el)
|
||||
delete(h.packetMap, p)
|
||||
return nil
|
||||
}
|
||||
@@ -139,10 +138,7 @@ func (h *sentPacketHistory) DeclareLost(p *Packet) *Packet {
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
// try to remove it from both lists, as we don't know which one it currently belongs to.
|
||||
// Remove is a no-op for elements that are not in the list.
|
||||
h.outstandingPacketList.Remove(el)
|
||||
h.etcPacketList.Remove(el)
|
||||
el.List().Remove(el)
|
||||
p.declaredLost = true
|
||||
// move it to the correct position in the etc list (based on the packet number)
|
||||
for el = h.etcPacketList.Back(); el != nil; el = el.Prev() {
|
||||
|
||||
@@ -43,6 +43,10 @@ func (e *Element[T]) Prev() *Element[T] {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (e *Element[T]) List() *List[T] {
|
||||
return e.list
|
||||
}
|
||||
|
||||
// List represents a doubly linked list.
|
||||
// The zero value for List is an empty list ready to use.
|
||||
type List[T any] struct {
|
||||
|
||||
Reference in New Issue
Block a user