From b87cb2c4a56450d1d53ec5c5f06bd30431516956 Mon Sep 17 00:00:00 2001 From: Maisem Ali Date: Fri, 11 Nov 2022 23:38:17 -0800 Subject: [PATCH] ipn/ipnlocal: call restart backend on user changes This makes it so that the backend also restarts when users change, otherwise an extra call to Start was required. Updates #713 Signed-off-by: Maisem Ali --- ipn/ipnlocal/local.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go index 1c40eed07..aef896abd 100644 --- a/ipn/ipnlocal/local.go +++ b/ipn/ipnlocal/local.go @@ -2100,8 +2100,15 @@ func (b *LocalBackend) shouldUploadServices() bool { func (b *LocalBackend) SetCurrentUserID(uid string) { b.mu.Lock() - b.pm.SetCurrentUser(uid) - b.mu.Unlock() + if b.pm.CurrentUser() == uid { + b.mu.Unlock() + return + } + if err := b.pm.SetCurrentUser(uid); err != nil { + b.mu.Unlock() + return + } + b.resetForProfileChangeLockedOnEntry() } func (b *LocalBackend) CheckPrefs(p *ipn.Prefs) error {