removing ping server function. Unnecessary

This commit is contained in:
afeiszli
2022-05-03 11:43:15 -04:00
parent 686026824c
commit 0531b6f78d
2 changed files with 1 additions and 23 deletions

View File

@@ -17,7 +17,6 @@ import (
"time"
mqtt "github.com/eclipse/paho.mqtt.golang"
"github.com/go-ping/ping"
"github.com/gravitl/netmaker/logger"
"github.com/gravitl/netmaker/netclient/auth"
"github.com/gravitl/netmaker/netclient/config"
@@ -110,23 +109,6 @@ func UpdateKeys(nodeCfg *config.ClientConfig, client mqtt.Client) error {
return nil
}
// PingServer -- checks if server is reachable
func PingServer(cfg *config.ClientConfig) error {
pinger, err := ping.NewPinger(cfg.Server.Server)
if err != nil {
return err
}
pinger.Timeout = 2 * time.Second
pinger.Count = 3
pinger.Run()
stats := pinger.Statistics()
if stats.PacketLoss == 100 {
return errors.New("ping error " + fmt.Sprintf("%f", stats.PacketLoss))
}
logger.Log(3, "ping of server", cfg.Server.Server, "was successful")
return nil
}
// == Private ==
// sets MQ client subscriptions for a specific node config

View File

@@ -75,11 +75,7 @@ func Checkin(ctx context.Context, wg *sync.WaitGroup) {
}
}
}
if err := PingServer(&nodeCfg); err != nil {
logger.Log(0, "could not ping server for", nodeCfg.Network, nodeCfg.Server.Server+"\n", err.Error())
} else {
Hello(&nodeCfg)
}
checkCertExpiry(&nodeCfg)
}
}