all: use atomic.Pointer

Also add some missing docs.

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2022-08-03 21:31:40 -07:00
committed by Maisem Ali
parent 5381437664
commit 9bb5a038e5
9 changed files with 21 additions and 24 deletions
+3 -3
View File
@@ -130,7 +130,7 @@ type LocalBackend struct {
sshAtomicBool syncs.AtomicBool
shutdownCalled bool // if Shutdown has been called
filterAtomic atomic.Value // of *filter.Filter
filterAtomic atomic.Pointer[filter.Filter]
containsViaIPFuncAtomic atomic.Value // of func(netip.Addr) bool
// The mutex protects the following elements.
@@ -577,8 +577,8 @@ func (b *LocalBackend) PeerCaps(src netip.Addr) []string {
if b.netMap == nil {
return nil
}
filt, ok := b.filterAtomic.Load().(*filter.Filter)
if !ok {
filt := b.filterAtomic.Load()
if filt == nil {
return nil
}
for _, a := range b.netMap.Addresses {