diff --git a/mq/handlers.go b/mq/handlers.go index 8500016a..aa24e904 100644 --- a/mq/handlers.go +++ b/mq/handlers.go @@ -18,7 +18,6 @@ func DefaultHandler(client mqtt.Client, msg mqtt.Message) { // Ping message Handler -- handles ping topic from client nodes func Ping(client mqtt.Client, msg mqtt.Message) { - logger.Log(0, "Ping Handler: ", msg.Topic()) go func() { id, err := getID(msg.Topic()) if err != nil { diff --git a/netclient/functions/mqhandlers.go b/netclient/functions/mqhandlers.go index 21893f6d..05d7b966 100644 --- a/netclient/functions/mqhandlers.go +++ b/netclient/functions/mqhandlers.go @@ -55,6 +55,7 @@ func NodeUpdate(client mqtt.Client, msg mqtt.Message) { // check if interface needs to delta ifaceDelta := ncutils.IfaceDelta(&nodeCfg.Node, &newNode) shouldDNSChange := nodeCfg.Node.DNSOn != newNode.DNSOn + hubChange := nodeCfg.Node.IsHub != newNode.IsHub nodeCfg.Node = newNode switch newNode.Action { @@ -126,6 +127,13 @@ func NodeUpdate(client mqtt.Client, msg mqtt.Message) { } else { ncutils.Log("signalled finished interface update to server") } + } else if hubChange { + doneErr := publishSignal(&commsCfg, &nodeCfg, ncutils.DONE) + if doneErr != nil { + ncutils.Log("could not notify server to update peers after hub change") + } else { + ncutils.Log("signalled finished hub update to server") + } } //deal with DNS if newNode.DNSOn != "yes" && shouldDNSChange && nodeCfg.Node.Interface != "" {