aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/service/install.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-03-02 05:54:25 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-03-02 07:07:05 +0100
commitf1b9349dadce2920187ea7def7397b514d801b38 (patch)
tree3e15404826ea98d13b938417cc7fcd145b9d7f42 /service/install.go
parentsyntax: flat border (diff)
downloadwireguard-windows-f1b9349dadce2920187ea7def7397b514d801b38.tar.xz
wireguard-windows-f1b9349dadce2920187ea7def7397b514d801b38.zip
ipc: work out service state transitions
Diffstat (limited to 'service/install.go')
-rw-r--r--service/install.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/service/install.go b/service/install.go
index 9a57504f..95a419de 100644
--- a/service/install.go
+++ b/service/install.go
@@ -13,6 +13,7 @@ import (
"golang.org/x/sys/windows/svc/mgr"
"golang.zx2c4.com/wireguard/windows/conf"
"os"
+ "syscall"
"time"
)
@@ -141,11 +142,11 @@ func InstallTunnel(configPath string) error {
}
for {
service, err = m.OpenService(serviceName)
- if err != nil {
+ if err != nil && err != syscall.Errno(ERROR_SERVICE_MARKED_FOR_DELETE) {
break
}
service.Close()
- time.Sleep(time.Second)
+ time.Sleep(time.Second / 3)
}
}
@@ -177,7 +178,7 @@ func UninstallTunnel(name string) error {
service.Control(svc.Stop)
err = service.Delete()
err2 := service.Close()
- if err != nil {
+ if err != nil && err != syscall.Errno(ERROR_SERVICE_MARKED_FOR_DELETE) {
return err
}
return err2