From 5cf38f62c433dcd5796beddc0e9c1ee41e288a8c Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Thu, 29 Feb 2024 18:00:38 +0100 Subject: [PATCH] update if save from pre 68 clients Signed-off-by: Kristoffer Dalby --- hscontrol/poll.go | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/hscontrol/poll.go b/hscontrol/poll.go index 66556e5c40a..cf4e7d31793 100644 --- a/hscontrol/poll.go +++ b/hscontrol/poll.go @@ -174,6 +174,9 @@ func (m *mapSession) serve() { } } + // TODO(kradalby): I think it would make more sense to tell people when the node + // registers than connects, thats more of a "is online" update. + // Set up the client stream m.h.pollNetMapStreamWG.Add(1) defer m.h.pollNetMapStreamWG.Done() @@ -202,18 +205,6 @@ func (m *mapSession) serve() { return } - // TODO(kradalby): I think it would make more sense to tell people when the node - // registers than connects, thats more of a "is online" update. - // ctx := types.NotifyCtx(context.Background(), "poll-connected-node-peers", m.node.Hostname) - // m.h.nodeNotifier.NotifyWithIgnore( - // ctx, - // types.StateUpdate{ - // Type: types.StatePeerChanged, - // ChangeNodes: []types.NodeID{m.node.ID}, - // Message: "called from handlePoll -> node (re)connected", - // }, - // m.node.MachineKey.String()) - if len(m.node.Routes) > 0 { go m.pollFailoverRoutes("new node", m.node) } @@ -544,6 +535,16 @@ func (m *mapSession) handleSaveNode() error { return err } + ctx := types.NotifyCtx(context.Background(), "pre-68-update-while-stream", m.node.Hostname) + m.h.nodeNotifier.NotifyWithIgnore( + ctx, + types.StateUpdate{ + Type: types.StatePeerChanged, + ChangeNodes: []types.NodeID{m.node.ID}, + Message: "called from handlePoll -> pre-68-update-while-stream", + }, + m.node.MachineKey.String()) + return nil }