Skip to content

Commit

Permalink
out of order when oneshot
Browse files Browse the repository at this point in the history
  • Loading branch information
jschwinger233 committed Nov 26, 2023
1 parent 1bd586c commit c283160
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ func main() {
}
}()

ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
ctx, stop := signal.NotifyContext(ctx, os.Interrupt, syscall.SIGTERM)
defer stop()

if err = bpfObjs.Load(bpf.LoadOptions{
Expand Down Expand Up @@ -118,7 +120,10 @@ func main() {

if config.Oneshot {
if ksym, _ := utils.Addr2ksym(skb.Meta.At); ksym == "kfree_skbmem" {
break
go func() {
time.Sleep(1 * time.Second)
cancel()
}()
}
}
}
Expand Down

0 comments on commit c283160

Please sign in to comment.