control/controlclient: make Status.Persist a PersistView

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali
2022-11-10 19:43:59 +05:00
committed by Maisem Ali
parent 4d330bac14
commit f00a49667d
6 changed files with 25 additions and 15 deletions

View File

@@ -818,10 +818,10 @@ func (b *LocalBackend) setClientStatus(st controlclient.Status) {
prefs.ControlURL = prefs.ControlURLOrDefault()
prefsChanged = true
}
if st.Persist != nil {
if !prefs.Persist.Equals(st.Persist) {
if st.Persist != nil && st.Persist.Valid() {
if !prefs.Persist.View().Equals(*st.Persist) {
prefsChanged = true
prefs.Persist = st.Persist.Clone()
prefs.Persist = st.Persist.AsStruct()
}
}
if st.URL != "" {

View File

@@ -139,10 +139,11 @@ func (cc *mockControl) populateKeys() (newKeys bool) {
// (In our tests here, upstream is the ipnlocal.Local instance.)
func (cc *mockControl) send(err error, url string, loginFinished bool, nm *netmap.NetworkMap) {
if cc.statusFunc != nil {
pv := cc.persist.View()
s := controlclient.Status{
URL: url,
NetMap: nm,
Persist: cc.persist,
Persist: &pv,
Err: err,
}
if loginFinished {