mirror of
https://github.com/yggdrasil-network/yggdrasil-go
synced 2024-11-10 07:20:39 +03:00
add some artifical delay to windows netsh commands, since it seems like maybe they don't take effect immediately, and this was leading to races when setting MTU
This commit is contained in:
parent
c53831696b
commit
8d2c31d39c
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
water "github.com/yggdrasil-network/water"
|
||||
)
|
||||
@ -42,6 +43,7 @@ func (tun *TunAdapter) setup(ifname string, iftapmode bool, addr string, mtu int
|
||||
tun.log.Traceln(string(output))
|
||||
return err
|
||||
}
|
||||
time.Sleep(time.Second) // FIXME artifical delay to give netsh time to take effect
|
||||
// Bring the interface back up
|
||||
cmd = exec.Command("netsh", "interface", "set", "interface", iface.Name(), "admin=ENABLED")
|
||||
tun.log.Debugln("netsh command:", strings.Join(cmd.Args, " "))
|
||||
@ -51,6 +53,7 @@ func (tun *TunAdapter) setup(ifname string, iftapmode bool, addr string, mtu int
|
||||
tun.log.Traceln(string(output))
|
||||
return err
|
||||
}
|
||||
time.Sleep(time.Second) // FIXME artifical delay to give netsh time to take effect
|
||||
// Get a new iface
|
||||
iface, err = water.New(config)
|
||||
if err != nil {
|
||||
@ -86,6 +89,7 @@ func (tun *TunAdapter) setupMTU(mtu int) error {
|
||||
tun.log.Traceln(string(output))
|
||||
return err
|
||||
}
|
||||
time.Sleep(time.Second) // FIXME artifical delay to give netsh time to take effect
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -106,5 +110,6 @@ func (tun *TunAdapter) setupAddress(addr string) error {
|
||||
tun.log.Traceln(string(output))
|
||||
return err
|
||||
}
|
||||
time.Sleep(time.Second) // FIXME artifical delay to give netsh time to take effect
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user