mirror of
https://github.com/tailscale/tailscale.git
synced 2025-03-26 03:01:02 +00:00
ipn/ipnlocal: be more assertive about rules for applyPrefsToHostinfo (now Locked)
The old docs were too cagey. Change-Id: I92c4fdc4165e7ca35c4537aebe51eb3604b56f6d Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
d3878ecd62
commit
6ea2d01626
@ -1184,7 +1184,7 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
|
|||||||
if b.inServerMode || runtime.GOOS == "windows" {
|
if b.inServerMode || runtime.GOOS == "windows" {
|
||||||
b.logf("Start: serverMode=%v", b.inServerMode)
|
b.logf("Start: serverMode=%v", b.inServerMode)
|
||||||
}
|
}
|
||||||
b.applyPrefsToHostinfo(hostinfo, prefs)
|
b.applyPrefsToHostinfoLocked(hostinfo, prefs)
|
||||||
|
|
||||||
b.setNetMapLocked(nil)
|
b.setNetMapLocked(nil)
|
||||||
persistv := prefs.Persist()
|
persistv := prefs.Persist()
|
||||||
@ -2213,7 +2213,7 @@ func (b *LocalBackend) setPrefsLockedOnEntry(caller string, newp *ipn.Prefs) ipn
|
|||||||
|
|
||||||
oldHi := b.hostinfo
|
oldHi := b.hostinfo
|
||||||
newHi := oldHi.Clone()
|
newHi := oldHi.Clone()
|
||||||
b.applyPrefsToHostinfo(newHi, newp.View())
|
b.applyPrefsToHostinfoLocked(newHi, newp.View())
|
||||||
b.hostinfo = newHi
|
b.hostinfo = newHi
|
||||||
hostInfoChanged := !oldHi.Equal(newHi)
|
hostInfoChanged := !oldHi.Equal(newHi)
|
||||||
cc := b.cc
|
cc := b.cc
|
||||||
@ -2954,8 +2954,8 @@ func unmapIPPrefixes(ippsList ...[]netip.Prefix) (ret []netip.Prefix) {
|
|||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warning: b.mu might be held. Currently (2022-02-17) both callers hold it.
|
// b.mu must be held.
|
||||||
func (b *LocalBackend) applyPrefsToHostinfo(hi *tailcfg.Hostinfo, prefs ipn.PrefsView) {
|
func (b *LocalBackend) applyPrefsToHostinfoLocked(hi *tailcfg.Hostinfo, prefs ipn.PrefsView) {
|
||||||
if h := prefs.Hostname(); h != "" {
|
if h := prefs.Hostname(); h != "" {
|
||||||
hi.Hostname = h
|
hi.Hostname = h
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user