logging: pass the packet number to ConnectionTracer.DroppedPacket (#4171)

In most cases the packet number is not known when a packet is dropped,
but it's useful to log the packet number when dropping a duplicate
packet.
This commit is contained in:
Marten Seemann
2023-11-17 13:11:16 +01:00
committed by GitHub
parent 96ab48eb7d
commit 3bf2e19d0d
11 changed files with 95 additions and 70 deletions

View File

@@ -20,7 +20,7 @@ type ConnectionTracer struct {
ReceivedLongHeaderPacket func(*ExtendedHeader, ByteCount, ECN, []Frame)
ReceivedShortHeaderPacket func(*ShortHeader, ByteCount, ECN, []Frame)
BufferedPacket func(PacketType, ByteCount)
DroppedPacket func(PacketType, ByteCount, PacketDropReason)
DroppedPacket func(PacketType, PacketNumber, ByteCount, PacketDropReason)
UpdatedMetrics func(rttStats *RTTStats, cwnd, bytesInFlight ByteCount, packetsInFlight int)
AcknowledgedPacket func(EncryptionLevel, PacketNumber)
LostPacket func(EncryptionLevel, PacketNumber, PacketLossReason)
@@ -139,10 +139,10 @@ func NewMultiplexedConnectionTracer(tracers ...*ConnectionTracer) *ConnectionTra
}
}
},
DroppedPacket: func(typ PacketType, size ByteCount, reason PacketDropReason) {
DroppedPacket: func(typ PacketType, pn PacketNumber, size ByteCount, reason PacketDropReason) {
for _, t := range tracers {
if t.DroppedPacket != nil {
t.DroppedPacket(typ, size, reason)
t.DroppedPacket(typ, pn, size, reason)
}
}
},