mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +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
|
||||
}
|
||||
|
||||
// Add context tracer and set context on packet.
|
||||
traceCtx, tracer := log.AddTracer(ctx)
|
||||
if tracer != nil {
|
||||
pkt.SetCtx(traceCtx)
|
||||
defer tracer.Submit()
|
||||
tracer.Tracef("filter: handling packet: %s", pkt)
|
||||
}
|
||||
pkt.SetCtx(traceCtx)
|
||||
|
||||
// associate packet to link and handle
|
||||
conn, ok := network.GetConnection(pkt.GetConnectionID())
|
||||
|
@ -327,8 +329,8 @@ func packetHandler(ctx context.Context) error {
|
|||
case <-ctx.Done():
|
||||
return nil
|
||||
case pkt := <-interception.Packets:
|
||||
interceptionModule.StartWorker("initial packet handler", func(ctx context.Context) error {
|
||||
handlePacket(ctx, pkt)
|
||||
interceptionModule.StartWorker("initial packet handler", func(workerCtx context.Context) error {
|
||||
handlePacket(workerCtx, pkt)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue