From 6c15fd60a05bbd2a85dd306700934cf3e6eb9786 Mon Sep 17 00:00:00 2001 From: Abhishek Kondur Date: Sat, 11 Nov 2023 10:08:50 +0400 Subject: [PATCH] publish deleted node update on disconnect --- mq/handlers.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mq/handlers.go b/mq/handlers.go index ba409f614..6b4c2ad37 100644 --- a/mq/handlers.go +++ b/mq/handlers.go @@ -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) } }