Skip to content

Commit

Permalink
avoid race condition
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Lehner <[email protected]>
  • Loading branch information
florianl committed Mar 25, 2022
1 parent 697db84 commit 04d1b2d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 2 additions & 2 deletions nfqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ func (nfqueue *Nfqueue) RegisterWithErrorFunc(ctx context.Context, fn HookFunc,
return err
}

nfqueue.wg.Add(1)
go func() {
nfqueue.wg.Add(1)
defer nfqueue.wg.Done()
nfqueue.socketCallback(ctx, fn, errfn, seq)
nfqueue.wg.Done()
}()

return nil
Expand Down
1 change: 0 additions & 1 deletion nfqueue_linux_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,4 @@ func TestTimeout(t *testing.T) {

// Block till the context expires
<-ctx.Done()

}

0 comments on commit 04d1b2d

Please sign in to comment.