all: use buildfeatures.HasCapture const in a handful of places

Help out the linker's dead code elimination.

Updates #12614

Change-Id: I6c13cb44d3250bf1e3a01ad393c637da4613affb
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2025-09-23 18:15:48 -07:00
committed by Brad Fitzpatrick
parent 8fe575409f
commit b54cdf9f38
5 changed files with 21 additions and 0 deletions
+6
View File
@@ -1026,6 +1026,9 @@ func (b *LocalBackend) onHealthChange(change health.Change) {
// GetOrSetCaptureSink returns the current packet capture sink, creating it
// with the provided newSink function if it does not already exist.
func (b *LocalBackend) GetOrSetCaptureSink(newSink func() packet.CaptureSink) packet.CaptureSink {
if !buildfeatures.HasCapture {
return nil
}
b.mu.Lock()
defer b.mu.Unlock()
@@ -1039,6 +1042,9 @@ func (b *LocalBackend) GetOrSetCaptureSink(newSink func() packet.CaptureSink) pa
}
func (b *LocalBackend) ClearCaptureSink() {
if !buildfeatures.HasCapture {
return
}
// Shut down & uninstall the sink if there are no longer
// any outputs on it.
b.mu.Lock()