qlog coalesced packets dropped due to wrong destination connection ID

This commit is contained in:
Marten Seemann
2020-04-07 16:47:30 +07:00
parent e5ebb32d01
commit 3bede6ddf5
2 changed files with 7 additions and 1 deletions

View File

@@ -717,6 +717,9 @@ func (s *session) handlePacketImpl(rp *receivedPacket) bool {
}
if counter > 0 && !hdr.DestConnectionID.Equal(lastConnID) {
if s.qlogger != nil {
s.qlogger.DroppedPacket(qlog.PacketTypeFromHeader(hdr), protocol.ByteCount(len(data)), qlog.PacketDropUnknownConnectionID)
}
s.logger.Debugf("coalesced packet has different destination connection ID: %s, expected %s", hdr.DestConnectionID, lastConnID)
break
}

View File

@@ -906,7 +906,10 @@ var _ = Describe("Session", func() {
})
_, packet2 := getPacketWithLength(wrongConnID, 123)
// don't EXPECT any more calls to unpacker.Unpack()
qlogger.EXPECT().ReceivedPacket(gomock.Any(), protocol.ByteCount(len(packet1.data)), gomock.Any())
gomock.InOrder(
qlogger.EXPECT().ReceivedPacket(gomock.Any(), protocol.ByteCount(len(packet1.data)), gomock.Any()),
qlogger.EXPECT().DroppedPacket(gomock.Any(), protocol.ByteCount(len(packet2.data)), qlog.PacketDropUnknownConnectionID),
)
packet1.data = append(packet1.data, packet2.data...)
Expect(sess.handlePacketImpl(packet1)).To(BeTrue())
})