From c5a0c62c4f926cd49041c71f5bda06f42235e325 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 29 Aug 2019 17:53:16 -0600 Subject: 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. --- manager/ipc_server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'manager/ipc_server.go') 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 { -- cgit v1.2.3-59-g8ed1b