bug fixes

This commit is contained in:
0xdcarns 2022-02-21 09:31:31 -05:00
parent a2392721e9
commit 3596754734
2 changed files with 8 additions and 1 deletions

View file

@ -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 {

View file

@ -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 != "" {