add missing tracing for dropped 0-RTT packets (#3762)

This commit is contained in:
Marten Seemann 2023-04-19 14:50:29 +02:00 committed by GitHub
parent 8507208665
commit a8a24a2bc2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -417,6 +417,9 @@ func (h *packetHandlerMap) handlePacket(p *receivedPacket) {
}
if wire.Is0RTTPacket(p.data) {
if h.numZeroRTTEntries >= protocol.Max0RTTQueues {
if h.tracer != nil {
h.tracer.DroppedPacket(p.remoteAddr, logging.PacketType0RTT, p.Size(), logging.PacketDropDOSPrevention)
}
return
}
h.numZeroRTTEntries++

View file

@ -323,6 +323,7 @@ var _ = Describe("Packet Handler Map", func() {
}
// We're already storing the maximum number of queues. This packet will be dropped.
connID := protocol.ParseConnectionID([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9})
tracer.EXPECT().DroppedPacket(gomock.Any(), logging.PacketType0RTT, gomock.Any(), logging.PacketDropDOSPrevention)
handler.handlePacket(&receivedPacket{data: getPacketWithPacketType(connID, protocol.PacketType0RTT, 1)})
// Don't EXPECT any handlePacket() calls.
conn := NewMockPacketHandler(mockCtrl)