wintun: add more retry loops
This commit is contained in:
parent
2e0ed4614a
commit
92f8474832
3 changed files with 56 additions and 30 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue