wintun: add more retry loops

This commit is contained in:
Jason A. Donenfeld
2019-03-31 10:17:11 +02:00
parent 2e0ed4614a
commit 92f8474832
3 changed files with 56 additions and 30 deletions

View File

@@ -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 {