Browse Source

fixing messages and keepalive

afeiszli 3 years ago
parent
commit
33f327f245
1 changed files with 6 additions and 3 deletions
  1. 6 3
      netclient/functions/daemon.go

+ 6 - 3
netclient/functions/daemon.go

@@ -321,12 +321,15 @@ func MonitorKeepalive(ctx context.Context, client mqtt.Client, cfg *config.Clien
 
 // ServerKeepAlive -- handler to react to keepalive messages published by server
 func ServerKeepAlive(client mqtt.Client, msg mqtt.Message) {
+	var mu sync.Mutex
+	mu.Lock()
+	defer mu.Unlock()
 	serverid, err := getID(msg.Topic())
 	if err != nil {
 		ncutils.Log("invalid ID in serverkeepalive topic")
 	}
 	keepalive[serverid] = time.Now()
-	ncutils.Log("keepalive from server")
+	// ncutils.Log("keepalive from server")
 }
 
 // Resubscribe --- handles resubscribing if needed
@@ -400,7 +403,7 @@ func Checkin(ctx context.Context, cfg *config.ClientConfig, network string) {
 			return
 			//delay should be configuraable -> use cfg.Node.NetworkSettings.DefaultCheckInInterval ??
 		case <-time.After(time.Second * 60):
-			ncutils.Log("Checkin running")
+			// ncutils.Log("Checkin running")
 			//read latest config
 			cfg.ReadConfig()
 			if cfg.Node.Roaming == "yes" && cfg.Node.IsStatic != "yes" {
@@ -434,7 +437,7 @@ func Checkin(ctx context.Context, cfg *config.ClientConfig, network string) {
 				}
 			}
 			Hello(cfg, network)
-			ncutils.Log("Checkin complete")
+			// ncutils.Log("Checkin complete")
 		}
 	}
 }