From 46dbf5404013e83867356ea8a590a45a569acbf4 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 2 May 2019 23:53:15 +0200 Subject: 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. --- tun/wintun/registryhacks_windows.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tun/wintun/registryhacks_windows.go') diff --git a/tun/wintun/registryhacks_windows.go b/tun/wintun/registryhacks_windows.go index bbcc020..94cc2f3 100644 --- a/tun/wintun/registryhacks_windows.go +++ b/tun/wintun/registryhacks_windows.go @@ -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) } } -- cgit v1.2.3