mirror of
https://github.com/gravitl/netmaker.git
synced 2025-11-17 22:48:49 +08:00
removing ping server function. Unnecessary
This commit is contained in:
parent
686026824c
commit
0531b6f78d
2 changed files with 1 additions and 23 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
Hello(&nodeCfg)
|
||||
checkCertExpiry(&nodeCfg)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue