embed the packetInfo in the receivedPacket struct

This avoid allocating the packetInfo struct when receiving a packet.
This commit is contained in:
Marten Seemann 2023-05-13 15:35:41 +03:00
parent 3b5950a1ce
commit edaeed0107
10 changed files with 42 additions and 36 deletions

View file

@ -16,13 +16,13 @@ type closedLocalConn struct {
perspective protocol.Perspective
logger utils.Logger
sendPacket func(net.Addr, *packetInfo)
sendPacket func(net.Addr, packetInfo)
}
var _ packetHandler = &closedLocalConn{}
// newClosedLocalConn creates a new closedLocalConn and runs it.
func newClosedLocalConn(sendPacket func(net.Addr, *packetInfo), pers protocol.Perspective, logger utils.Logger) packetHandler {
func newClosedLocalConn(sendPacket func(net.Addr, packetInfo), pers protocol.Perspective, logger utils.Logger) packetHandler {
return &closedLocalConn{
sendPacket: sendPacket,
perspective: pers,