wintun: don't retry when not creating

The only time we're trying to counteract the race condition is when
we're creating a driver. When we're simply looking up all drivers, it
doesn't make sense to retry.
This commit is contained in:
Jason A. Donenfeld
2019-05-02 23:53:15 +02:00
parent 247e14693a
commit 46dbf54040
2 changed files with 26 additions and 9 deletions

View File

@@ -11,7 +11,7 @@ import (
)
const (
numRetries = 100
numRetries = 100
retryTimeout = 150 * time.Millisecond
)
@@ -21,7 +21,7 @@ func registryOpenKeyRetry(k registry.Key, path string, access uint32) (key regis
if err == nil {
break
}
if i != numRetries - 1 {
if i != numRetries-1 {
time.Sleep(retryTimeout)
}
}
@@ -34,7 +34,7 @@ func keyGetStringValueRetry(k registry.Key, name string) (val string, valtype ui
if err == nil {
break
}
if i != numRetries - 1 {
if i != numRetries-1 {
time.Sleep(retryTimeout)
}
}