aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/service/service_manager.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-04-30 14:01:42 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-04-30 20:19:50 +0200
commit6a998c3026c832807d0e7db99c52dba1187bbbc7 (patch)
tree456e11464978e66542d98def6b8e1374bbec34d8 /service/service_manager.go
parentui: pick more windowsy colors (diff)
downloadwireguard-windows-6a998c3026c832807d0e7db99c52dba1187bbbc7.tar.xz
wireguard-windows-6a998c3026c832807d0e7db99c52dba1187bbbc7.zip
service: inform UIs it is time to quit so they can kill tray
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'service/service_manager.go')
-rw-r--r--service/service_manager.go6
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()
}