diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-30 14:01:42 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-04-30 20:19:50 +0200 |
commit | 508d45a6f7195970d0bc68a1223a3282ce666010 (patch) | |
tree | 456e11464978e66542d98def6b8e1374bbec34d8 /service/service_manager.go | |
parent | ui: pick more windowsy colors (diff) | |
download | wireguard-windows-508d45a6f7195970d0bc68a1223a3282ce666010.tar.xz wireguard-windows-508d45a6f7195970d0bc68a1223a3282ce666010.zip |
service: inform UIs it is time to quit so they can kill tray
Diffstat (limited to 'service/service_manager.go')
-rw-r--r-- | service/service_manager.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/service/service_manager.go b/service/service_manager.go index b3752d31..33729795 100644 --- a/service/service_manager.go +++ b/service/service_manager.go @@ -143,9 +143,13 @@ func (service *managerService) Execute(args []string, r <-chan svc.ChangeRequest procs := make(map[uint32]*os.Process) procsLock := sync.Mutex{} var startProcess func(session uint32) + stoppingManager := false startProcess = func(session uint32) { for { + if stoppingManager { + return + } var userToken windows.Token err := wtfQueryUserToken(session, &userToken) if err != nil { @@ -305,6 +309,8 @@ loop: changes <- svc.Status{State: svc.StopPending} procsLock.Lock() + stoppingManager = true + IPCServerNotifyManagerStopping() for _, proc := range procs { proc.Kill() } |