diff --git a/mq/handlers.go b/mq/handlers.go index 434d309f..271cb376 100644 --- a/mq/handlers.go +++ b/mq/handlers.go @@ -121,7 +121,7 @@ func UpdateNode(client mqtt.Client, msg mqtt.Message) { // UpdateHost message Handler -- handles host updates from clients func UpdateHost(client mqtt.Client, msg mqtt.Message) { go func(msg mqtt.Message) { - id, err := getHostID(msg.Topic()) + id, err := getID(msg.Topic()) if err != nil { logger.Log(1, "error getting host.ID sent on ", msg.Topic(), err.Error()) return diff --git a/mq/util.go b/mq/util.go index f413db37..0ab59ee9 100644 --- a/mq/util.go +++ b/mq/util.go @@ -94,13 +94,3 @@ func getID(topic string) (string, error) { //the last part of the topic will be the node.ID return parts[count-1], nil } - -// decodes a message queue topic and returns the embedded host.ID -func getHostID(topic string) (string, error) { - parts := strings.Split(topic, "/") - count := len(parts) - if count < 3 { - return "", fmt.Errorf("invalid topic") - } - return parts[2], nil -}