mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-05 08:47:35 +08:00
removing ping server function. Unnecessary
This commit is contained in:
@@ -17,7 +17,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
mqtt "github.com/eclipse/paho.mqtt.golang"
|
mqtt "github.com/eclipse/paho.mqtt.golang"
|
||||||
"github.com/go-ping/ping"
|
|
||||||
"github.com/gravitl/netmaker/logger"
|
"github.com/gravitl/netmaker/logger"
|
||||||
"github.com/gravitl/netmaker/netclient/auth"
|
"github.com/gravitl/netmaker/netclient/auth"
|
||||||
"github.com/gravitl/netmaker/netclient/config"
|
"github.com/gravitl/netmaker/netclient/config"
|
||||||
@@ -110,23 +109,6 @@ func UpdateKeys(nodeCfg *config.ClientConfig, client mqtt.Client) error {
|
|||||||
return nil
|
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 ==
|
// == Private ==
|
||||||
|
|
||||||
// sets MQ client subscriptions for a specific node config
|
// 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 {
|
Hello(&nodeCfg)
|
||||||
logger.Log(0, "could not ping server for", nodeCfg.Network, nodeCfg.Server.Server+"\n", err.Error())
|
|
||||||
} else {
|
|
||||||
Hello(&nodeCfg)
|
|
||||||
}
|
|
||||||
checkCertExpiry(&nodeCfg)
|
checkCertExpiry(&nodeCfg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user