summaryrefslogtreecommitdiffhomepage
path: root/tun/tun_windows.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-03-31 10:17:11 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-04-01 09:07:43 +0200
commit92f847483200a63193d55418381e685621b24e5c (patch)
treed03dec21526ee523e5364a615321ede58e3a2ec7 /tun/tun_windows.go
parent2e0ed4614addc5e1842cf652c5d23779581ca7f2 (diff)
wintun: add more retry loops
Diffstat (limited to 'tun/tun_windows.go')
-rw-r--r--tun/tun_windows.go17
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 {