mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
all: use atomic.Pointer
Also add some missing docs. Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
@@ -24,8 +24,8 @@ func init() {
|
||||
} else if n > 10000 {
|
||||
n = 10000
|
||||
}
|
||||
fl, ok := fwdLogAtomic.Load().(*fwdLog)
|
||||
if !ok || n != len(fl.ent) {
|
||||
fl := fwdLogAtomic.Load()
|
||||
if fl == nil || n != len(fl.ent) {
|
||||
fl = &fwdLog{ent: make([]fwdLogEntry, n)}
|
||||
fwdLogAtomic.Store(fl)
|
||||
}
|
||||
@@ -33,7 +33,7 @@ func init() {
|
||||
}))
|
||||
}
|
||||
|
||||
var fwdLogAtomic atomic.Value // of *fwdLog
|
||||
var fwdLogAtomic atomic.Pointer[fwdLog]
|
||||
|
||||
type fwdLog struct {
|
||||
mu sync.Mutex
|
||||
|
@@ -688,7 +688,7 @@ func (f *forwarder) forwardWithDestChan(ctx context.Context, query packet, respo
|
||||
}
|
||||
}
|
||||
|
||||
if fl, ok := fwdLogAtomic.Load().(*fwdLog); ok {
|
||||
if fl := fwdLogAtomic.Load(); fl != nil {
|
||||
fl.addName(string(domain))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user