mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 20:57:36 +03:00
put back the packet buffer when parsing the connection ID fails
This commit is contained in:
parent
d7c2169c55
commit
87f53228e9
2 changed files with 2 additions and 1 deletions
|
@ -273,6 +273,7 @@ func (h *packetHandlerMap) handlePacket(
|
||||||
) {
|
) {
|
||||||
connID, err := wire.ParseConnectionID(data, h.connIDLen)
|
connID, err := wire.ParseConnectionID(data, h.connIDLen)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
buffer.MaybeRelease()
|
||||||
h.logger.Debugf("error parsing connection ID on packet from %s: %s", addr, err)
|
h.logger.Debugf("error parsing connection ID on packet from %s: %s", addr, err)
|
||||||
if h.tracer != nil {
|
if h.tracer != nil {
|
||||||
h.tracer.DroppedPacket(addr, logging.PacketTypeNotDetermined, protocol.ByteCount(len(data)), logging.PacketDropHeaderParseError)
|
h.tracer.DroppedPacket(addr, logging.PacketTypeNotDetermined, protocol.ByteCount(len(data)), logging.PacketDropHeaderParseError)
|
||||||
|
|
|
@ -130,7 +130,7 @@ var _ = Describe("Packet Handler Map", func() {
|
||||||
It("drops unparseable packets", func() {
|
It("drops unparseable packets", func() {
|
||||||
addr := &net.UDPAddr{IP: net.IPv4(9, 8, 7, 6), Port: 1234}
|
addr := &net.UDPAddr{IP: net.IPv4(9, 8, 7, 6), Port: 1234}
|
||||||
tracer.EXPECT().DroppedPacket(addr, logging.PacketTypeNotDetermined, protocol.ByteCount(4), logging.PacketDropHeaderParseError)
|
tracer.EXPECT().DroppedPacket(addr, logging.PacketTypeNotDetermined, protocol.ByteCount(4), logging.PacketDropHeaderParseError)
|
||||||
handler.handlePacket(addr, nil, []byte{0, 1, 2, 3})
|
handler.handlePacket(addr, getPacketBuffer(), []byte{0, 1, 2, 3})
|
||||||
})
|
})
|
||||||
|
|
||||||
It("deletes removed sessions immediately", func() {
|
It("deletes removed sessions immediately", func() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue