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
+1 -3
View File
@@ -189,8 +189,8 @@ func (bs *BackendServer) GotCommand(ctx context.Context, cmd *Command) error {
bs.GotQuit = true
return errors.New("Quit command received")
} else if c := cmd.Start; c != nil {
bs.b.SetNotifyCallback(bs.send)
opts := c.Opts
opts.Notify = bs.send
return bs.b.Start(opts)
} else if c := cmd.StartLoginInteractive; c != nil {
bs.b.StartLoginInteractive()
@@ -287,8 +287,6 @@ func (bc *BackendClient) Quit() error {
}
func (bc *BackendClient) Start(opts Options) error {
bc.notify = opts.Notify
opts.Notify = nil // server can't call our function pointer
bc.send(Command{Start: &StartArgs{Opts: opts}})
return nil // remote Start() errors must be handled remotely
}