Skip to content

Commit

Permalink
NetWatcher error channel doesn't need buffering
Browse files Browse the repository at this point in the history
It's likely fine to have the writing goroutine hanging until someone calls Stop() to read the channel.
But I still prefer to log the error right away.
  • Loading branch information
CarlosNihelton committed Sep 5, 2024
1 parent 92ad6f4 commit bf0d1d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions windows-agent/internal/daemon/netwatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,16 @@ func subscribe(ctx context.Context, callback NewAdapterCallback, opts options) (
ctx: nctx,
cancel: cancel,
callback: callback,
err: make(chan error, 1),
err: make(chan error),
cache: current,
}

go func() {
defer close(n.err)

err := n.start()
n.err <- err
log.Debugf(context.Background(), "stopped monitoring network adapters: %v", err)
n.err <- err
}()
return n, nil
}
Expand Down

0 comments on commit bf0d1d4

Please sign in to comment.