Skip to content

Commit

Permalink
pipeline: fix events not going through emit check in sink (aquasecuri…
Browse files Browse the repository at this point in the history
  • Loading branch information
NDStrahilevitz authored May 8, 2022
1 parent 6b87951 commit a2eb1f6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/ebpf/events_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ func (t *Tracee) sinkEvents(ctx gocontext.Context, in <-chan *trace.Event) <-cha
errc := make(chan error, 1)

go func() {
defer close(errc)
for event := range in {
// Only emit events requested by the user
if t.events[int32(event.EventID)].emit {
Expand All @@ -250,14 +251,13 @@ func (t *Tracee) sinkEvents(ctx gocontext.Context, in <-chan *trace.Event) <-cha
continue
}
}
}

select {
case t.config.ChanEvents <- *event:
t.stats.EventCount.Increment()
event = nil
case <-ctx.Done():
return
select {
case t.config.ChanEvents <- *event:
t.stats.EventCount.Increment()
event = nil
case <-ctx.Done():
return
}
}
}
}()
Expand Down

0 comments on commit a2eb1f6

Please sign in to comment.