diff options
author | Simon Rozman <simon@rozman.si> | 2019-05-09 10:11:15 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-10 16:43:58 +0200 |
commit | 7e962a9932667f4a161b20aba5ff1c75ab8e578a (patch) | |
tree | 212eb2c6bc55db43c0b982b71195fc3ec61ce659 /tun/wintun/registryhacks_windows.go | |
parent | 586112b5d78abc99c9858c9a9a40756d5854d311 (diff) |
wintun: wait for interface registry key on device creation
By using RegNotifyChangeKeyValue(). Also disable dead gateway detection.
Signed-off-by: Simon Rozman <simon@rozman.si>
Diffstat (limited to 'tun/wintun/registryhacks_windows.go')
-rw-r--r-- | tun/wintun/registryhacks_windows.go | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/tun/wintun/registryhacks_windows.go b/tun/wintun/registryhacks_windows.go deleted file mode 100644 index bf72f92..0000000 --- a/tun/wintun/registryhacks_windows.go +++ /dev/null @@ -1,42 +0,0 @@ -/* SPDX-License-Identifier: MIT - * - * Copyright (C) 2019 WireGuard LLC. All Rights Reserved. - */ - -package wintun - -import ( - "golang.org/x/sys/windows/registry" - "time" -) - -const ( - numRetries = 50 - retryTimeout = 100 * time.Millisecond -) - -func registryOpenKeyRetry(k registry.Key, path string, access uint32) (key registry.Key, err error) { - for i := 0; i < numRetries; i++ { - key, err = registry.OpenKey(k, path, access) - if err == nil { - break - } - if i != numRetries-1 { - time.Sleep(retryTimeout) - } - } - return -} - -func keyGetStringValueRetry(k registry.Key, name string) (val string, valtype uint32, err error) { - for i := 0; i < numRetries; i++ { - val, valtype, err = k.GetStringValue(name) - if err == nil { - break - } - if i != numRetries-1 { - time.Sleep(retryTimeout) - } - } - return -} |