Merge pull request #678 from gravitl/feature_v0.10.0_route_consolidate

moved check outside loop
This commit is contained in:
dcarns 2022-02-05 14:33:00 -05:00 committed by GitHub
commit e9aa94bab5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -177,8 +177,8 @@ func InitWireguard(node *models.Node, privkey string, peers []wgtypes.PeerConfig
ncutils.PrintLog("waiting for interface...", 1) // ensure interface is created ncutils.PrintLog("waiting for interface...", 1) // ensure interface is created
output, _ := ncutils.RunCmd("wg", false) output, _ := ncutils.RunCmd("wg", false)
starttime := time.Now() starttime := time.Now()
ifaceReady := false ifaceReady := !strings.Contains(output, ifacename)
for !strings.Contains(output, ifacename) && !(time.Now().After(starttime.Add(time.Second << 4))) { for !ifaceReady && !(time.Now().After(starttime.Add(time.Second << 4))) {
output, _ = ncutils.RunCmd("wg", false) output, _ = ncutils.RunCmd("wg", false)
err = ApplyConf(node, ifacename, confPath) err = ApplyConf(node, ifacename, confPath)
time.Sleep(time.Second) time.Sleep(time.Second)