mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
5e7c0b025c
A number of methods in LocalBackend (with suffixed "LockedOnEntry") require b.mu be held but unlock it on the way out. That's asymmetric and atypical and error prone. This adds a helper method to LocalBackend that locks the mutex and returns a sync.OnceFunc that unlocks the mutex. Then we pass around that unlocker func down the chain to make it explicit (and somewhat type check the passing of ownership) but also let the caller defer unlock it, in the case of errors/panics that happen before the callee gets around to calling the unlock. This revealed a latent bug in LocalBackend.DeleteProfile which double unlocked the mutex. Updates #11649 Change-Id: I002f77567973bd77b8906bfa4ec9a2049b89836a Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com> |
||
---|---|---|
.. | ||
conffile | ||
ipnauth | ||
ipnlocal | ||
ipnserver | ||
ipnstate | ||
localapi | ||
policy | ||
store | ||
backend.go | ||
conf.go | ||
doc.go | ||
fake_test.go | ||
ipn_clone.go | ||
ipn_test.go | ||
ipn_view.go | ||
prefs_test.go | ||
prefs.go | ||
serve_test.go | ||
serve.go | ||
store_test.go | ||
store.go |