aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/service
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-02-28 04:16:04 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-02-28 08:05:02 +0100
commit37ce1d0654ea7b69242097068ae4a75f40b3a2b2 (patch)
treee9ced18b3272875520c43f6ffea0c7e07cc8438a /service
parentipc: implement event system with pipes (diff)
downloadwireguard-windows-37ce1d0654ea7b69242097068ae4a75f40b3a2b2.tar.xz
wireguard-windows-37ce1d0654ea7b69242097068ae4a75f40b3a2b2.zip
manager: wire up tunnels changed notifier
Diffstat (limited to 'service')
-rw-r--r--service/ipc_server.go4
-rw-r--r--service/service_manager.go3
2 files changed, 7 insertions, 0 deletions
diff --git a/service/ipc_server.go b/service/ipc_server.go
index 73c2916e..4388bb00 100644
--- a/service/ipc_server.go
+++ b/service/ipc_server.go
@@ -151,6 +151,10 @@ func IPCServerListen(reader *os.File, writer *os.File, events *os.File) error {
}
func notifyAll(notificationType NotificationType, iface interface{}) {
+ if len(managerServices) == 0 {
+ return
+ }
+
var buf bytes.Buffer
encoder := gob.NewEncoder(&buf)
err := encoder.Encode(notificationType)
diff --git a/service/service_manager.go b/service/service_manager.go
index eb28e833..6b4a9b90 100644
--- a/service/service_manager.go
+++ b/service/service_manager.go
@@ -9,6 +9,7 @@ import (
"golang.org/x/sys/windows"
"golang.org/x/sys/windows/svc"
"golang.org/x/sys/windows/svc/eventlog"
+ "golang.zx2c4.com/wireguard/windows/conf"
"log"
"os"
"strconv"
@@ -128,6 +129,8 @@ func (service *managerService) Execute(args []string, r <-chan svc.ChangeRequest
return
}
+ conf.RegisterStoreChangeCallback(IPCServerNotifyTunnelsChange)
+
procs := make(map[uint32]*os.Process)
procsLock := sync.Mutex{}
var startProcess func(session uint32)