diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-03-31 10:17:11 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-01 09:07:43 +0200 |
commit | 92f847483200a63193d55418381e685621b24e5c (patch) | |
tree | d03dec21526ee523e5364a615321ede58e3a2ec7 /tun/tun_windows.go | |
parent | 2e0ed4614addc5e1842cf652c5d23779581ca7f2 (diff) |
wintun: add more retry loops
Diffstat (limited to 'tun/tun_windows.go')
-rw-r--r-- | tun/tun_windows.go | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/tun/tun_windows.go b/tun/tun_windows.go index 9428373..948f08d 100644 --- a/tun/tun_windows.go +++ b/tun/tun_windows.go @@ -75,18 +75,11 @@ func CreateTUN(ifname string) (TUNDevice, error) { return nil, err } - go func() { - retries := retryTimeout * retryRate - for { - err := wt.SetInterfaceName(ifname) - if err != nil && retries > 0 { - time.Sleep(time.Second / retryRate) - retries-- - continue - } - return - } - }() + err = wt.SetInterfaceName(ifname) + if err != nil { + wt.DeleteInterface(0) + return nil, err + } err = wt.FlushInterface() if err != nil { |