mirror of
https://github.com/safing/portmaster
synced 2025-09-02 18:49:14 +00:00
Merge pull request #205 from safing/fix/packet-context
Fix tracing context assigned to packets
This commit is contained in:
commit
b29775b6a1
1 changed files with 5 additions and 3 deletions
|
@ -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
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue