mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-05 08:47:35 +08:00
remove go routines for handling reciept of subscribed messages
This commit is contained in:
@@ -224,8 +224,6 @@ var All mqtt.MessageHandler = func(client mqtt.Client, msg mqtt.Message) {
|
||||
|
||||
// NodeUpdate -- mqtt message handler for /update/<NodeID> topic
|
||||
func NodeUpdate(client mqtt.Client, msg mqtt.Message) {
|
||||
//potentiall blocking i/o so do this in a go routine
|
||||
go func() {
|
||||
var newNode models.Node
|
||||
var cfg config.ClientConfig
|
||||
var network = parseNetworkFromTopic(msg.Topic())
|
||||
@@ -333,12 +331,10 @@ func NodeUpdate(client mqtt.Client, msg mqtt.Message) {
|
||||
ncutils.Log("error applying dns" + err.Error())
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// UpdatePeers -- mqtt message handler for peers/<Network>/<NodeID> topic
|
||||
func UpdatePeers(client mqtt.Client, msg mqtt.Message) {
|
||||
go func() {
|
||||
var peerUpdate models.PeerUpdate
|
||||
var network = parseNetworkFromTopic(msg.Topic())
|
||||
var cfg = config.ClientConfig{}
|
||||
@@ -374,7 +370,6 @@ func UpdatePeers(client mqtt.Client, msg mqtt.Message) {
|
||||
return
|
||||
}
|
||||
ncutils.Log(fmt.Sprintf("received peer update on network, %s", cfg.Network))
|
||||
}()
|
||||
}
|
||||
|
||||
// MonitorKeepalive - checks time last server keepalive received. If more than 3+ minutes, notify and resubscribe
|
||||
@@ -456,7 +451,6 @@ func Resubscribe(client mqtt.Client, cfg *config.ClientConfig) error {
|
||||
// UpdateKeys -- updates private key and returns new publickey
|
||||
func UpdateKeys(cfg *config.ClientConfig, client mqtt.Client) error {
|
||||
ncutils.Log("received message to update keys")
|
||||
//potentiall blocking i/o so do this in a go routine
|
||||
key, err := wgtypes.GeneratePrivateKey()
|
||||
if err != nil {
|
||||
ncutils.Log("error generating privatekey " + err.Error())
|
||||
|
Reference in New Issue
Block a user