mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-12 05:37:32 +00:00
all: use atomic.Pointer
Also add some missing docs. Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
@@ -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 {
|
||||
|
@@ -973,8 +973,8 @@ func (h *peerAPIHandler) replyToDNSQueries() bool {
|
||||
// ourselves. As a proxy for autogroup:internet access, we see
|
||||
// if we would've accepted a packet to 0.0.0.0:53. We treat
|
||||
// the IP 0.0.0.0 as being "the internet".
|
||||
f, ok := b.filterAtomic.Load().(*filter.Filter)
|
||||
if !ok {
|
||||
f := b.filterAtomic.Load()
|
||||
if f == nil {
|
||||
return false
|
||||
}
|
||||
// Note: we check TCP here because the Filter type already had
|
||||
|
Reference in New Issue
Block a user