Skip to content

Commit

Permalink
publish deleted node update on disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishek9686 committed Nov 11, 2023
1 parent 83e83f8 commit 6c15fd6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion mq/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ func UpdateNode(client mqtt.Client, msg mqtt.Message) {
return
}
if ifaceDelta { // reduce number of unneeded updates, by only sending on iface changes
if err = PublishPeerUpdate(); err != nil {
if !newNode.Connected {
err = PublishDeletedNodePeerUpdate(&newNode)
} else {
err = PublishPeerUpdate()
}
if err != nil {
slog.Warn("error updating peers when node informed the server of an interface change", "nodeid", currentNode.ID, "error", err)
}
}
Expand Down

0 comments on commit 6c15fd6

Please sign in to comment.