diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-08-29 17:53:16 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-08-30 08:47:21 -0600 |
commit | c5a0c62c4f926cd49041c71f5bda06f42235e325 (patch) | |
tree | 15711f7168e95ff317ed850b86f5295b52c97b81 /manager/ipc_server.go | |
parent | manager: adjust for wintun api changes (diff) | |
download | wireguard-windows-c5a0c62c4f926cd49041c71f5bda06f42235e325.tar.xz wireguard-windows-c5a0c62c4f926cd49041c71f5bda06f42235e325.zip |
manager: delay stale adapter cleanup
By delaying this by 10 seconds, we ensure that we don't cause the locks
to be contended immediately on startup. Before, this added around 600ms
of latency to tunnel startup.
Diffstat (limited to 'manager/ipc_server.go')
-rw-r--r-- | manager/ipc_server.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/manager/ipc_server.go b/manager/ipc_server.go index ed60d6b6..3bb92066 100644 --- a/manager/ipc_server.go +++ b/manager/ipc_server.go @@ -107,7 +107,7 @@ func (s *ManagerService) Start(tunnelName string, unused *uintptr) error { } } }() - go cleanupStaleAdapters() + time.AfterFunc(time.Second*10, cleanupStaleWintunInterfaces) // After that process is started -- it's somewhat asynchronous -- we install the new one. c, err := conf.LoadFromName(tunnelName) @@ -122,7 +122,7 @@ func (s *ManagerService) Start(tunnelName string, unused *uintptr) error { } func (s *ManagerService) Stop(tunnelName string, _ *uintptr) error { - go cleanupStaleAdapters() + time.AfterFunc(time.Second*10, cleanupStaleWintunInterfaces) err := UninstallTunnel(tunnelName) if err == windows.ERROR_SERVICE_DOES_NOT_EXIST { |