Fix tracing context assigned to packets
This commit is contained in:
@@ -64,11 +64,13 @@ func handlePacket(ctx context.Context, pkt packet.Packet) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add context tracer and set context on packet.
|
||||||
traceCtx, tracer := log.AddTracer(ctx)
|
traceCtx, tracer := log.AddTracer(ctx)
|
||||||
if tracer != nil {
|
if tracer != nil {
|
||||||
pkt.SetCtx(traceCtx)
|
defer tracer.Submit()
|
||||||
tracer.Tracef("filter: handling packet: %s", pkt)
|
tracer.Tracef("filter: handling packet: %s", pkt)
|
||||||
}
|
}
|
||||||
|
pkt.SetCtx(traceCtx)
|
||||||
|
|
||||||
// associate packet to link and handle
|
// associate packet to link and handle
|
||||||
conn, ok := network.GetConnection(pkt.GetConnectionID())
|
conn, ok := network.GetConnection(pkt.GetConnectionID())
|
||||||
@@ -327,8 +329,8 @@ func packetHandler(ctx context.Context) error {
|
|||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return nil
|
return nil
|
||||||
case pkt := <-interception.Packets:
|
case pkt := <-interception.Packets:
|
||||||
interceptionModule.StartWorker("initial packet handler", func(ctx context.Context) error {
|
interceptionModule.StartWorker("initial packet handler", func(workerCtx context.Context) error {
|
||||||
handlePacket(ctx, pkt)
|
handlePacket(workerCtx, pkt)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user