Skip to content

Commit

Permalink
update if save from pre 68 clients
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <[email protected]>
  • Loading branch information
kradalby committed Feb 29, 2024
1 parent aab7f80 commit 5cf38f6
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions hscontrol/poll.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 5cf38f6

Please sign in to comment.