ipn: move Options.Notify to its own method

We already had SetNotifyCallback elsewhere on controlclient, so use
that name.

Baby steps towards some CLI refactor work.

Updates tailscale/tailscale#1436
This commit is contained in:
Brad Fitzpatrick
2021-04-06 22:11:50 -07:00
parent d488678fdc
commit 799973a68d
8 changed files with 122 additions and 90 deletions

View File

@@ -519,6 +519,12 @@ func (b *LocalBackend) setWgengineStatus(s *wgengine.Status, err error) {
b.send(ipn.Notify{Engine: &es})
}
func (b *LocalBackend) SetNotifyCallback(notify func(ipn.Notify)) {
b.mu.Lock()
defer b.mu.Unlock()
b.notify = notify
}
// Start applies the configuration specified in opts, and starts the
// state machine.
//
@@ -585,7 +591,6 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
}
applyPrefsToHostinfo(hostinfo, b.prefs)
b.notify = opts.Notify
b.setNetMapLocked(nil)
persistv := b.prefs.Persist
b.mu.Unlock()