From d9ee9a0d3fefc6a30482467165097343432eb4c8 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Mon, 12 Apr 2021 10:33:50 -0700 Subject: [PATCH] ipn: set BackendServer's notify earlier; don't require Start We've been slowly making Start less special and making IPN a multi-connection "watch" bus of changes, but this Start specialness had remained. Signed-off-by: Brad Fitzpatrick --- ipn/message.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ipn/message.go b/ipn/message.go index 9a8a327f1..fe3df7d67 100644 --- a/ipn/message.go +++ b/ipn/message.go @@ -94,11 +94,13 @@ type BackendServer struct { } func NewBackendServer(logf logger.Logf, b Backend, sendNotifyMsg func(b []byte)) *BackendServer { - return &BackendServer{ + bs := &BackendServer{ logf: logf, b: b, sendNotifyMsg: sendNotifyMsg, } + b.SetNotifyCallback(bs.send) + return bs } func (bs *BackendServer) send(n Notify) { @@ -188,7 +190,6 @@ 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 return bs.b.Start(opts) } else if c := cmd.StartLoginInteractive; c != nil {