From 92f847483200a63193d55418381e685621b24e5c Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 31 Mar 2019 10:17:11 +0200 Subject: wintun: add more retry loops --- tun/tun_windows.go | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'tun/tun_windows.go') 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 { -- cgit v1.2.3-59-g8ed1b