mirror of
https://github.com/tailscale/tailscale.git
synced 2025-05-28 18:28:32 +00:00
control/controlclient: flesh out a recently added comment
Updates tailscale/corp#26058 Change-Id: Ib46161fbb2e79c080f886083665961f02cbf5949
This commit is contained in:
parent
ed8bb3b564
commit
0ed4aa028f
@ -620,12 +620,17 @@ func (c *Auto) sendStatus(who string, err error, url string, nm *netmap.NetworkM
|
||||
}
|
||||
}
|
||||
c.observer.SetControlClientStatus(c, *newSt)
|
||||
// Best effort stop retaining the memory now that
|
||||
// we've sent it to the observer (LocalBackend).
|
||||
// We CAS here because the caller goroutine is
|
||||
// doing a Store which we want to want to win
|
||||
// a race. This is only a memory optimization
|
||||
// and is not for correctness:
|
||||
|
||||
// Best effort stop retaining the memory now that we've sent it to the
|
||||
// observer (LocalBackend). We CAS here because the caller goroutine is
|
||||
// doing a Store which we want to win a race. This is only a memory
|
||||
// optimization and is not for correctness.
|
||||
//
|
||||
// If the CAS fails, that means somebody else's Store replaced our
|
||||
// pointer (so mission accomplished: our netmap is no longer retained in
|
||||
// any case) and that Store caller will be responsible for removing
|
||||
// their own netmap (or losing their race too, down the chain).
|
||||
// Eventually the last caller will win this CAS and zero lastStatus.
|
||||
c.lastStatus.CompareAndSwap(newSt, nil)
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user