aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/service/ipc_server.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-04-26 20:05:24 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2019-04-27 08:24:22 +0200
commit3e8cf39903775ecb6b8ebe03d43591453fe3c7d8 (patch)
treed62408b62529d0e18a19866d540c1c87cfa957c1 /service/ipc_server.go
parentinstaller: new checksums for working msm (diff)
downloadwireguard-windows-3e8cf39903775ecb6b8ebe03d43591453fe3c7d8.tar.xz
wireguard-windows-3e8cf39903775ecb6b8ebe03d43591453fe3c7d8.zip
ui: simplify everything
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r--service/ipc_server.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/service/ipc_server.go b/service/ipc_server.go
index 17ea67c2..6d576846 100644
--- a/service/ipc_server.go
+++ b/service/ipc_server.go
@@ -71,6 +71,18 @@ func (s *ManagerService) RuntimeConfig(tunnelName string, config *conf.Config) e
}
func (s *ManagerService) Start(tunnelName string, unused *uintptr) error {
+ // For now, enforce only one tunnel at a time. Later we'll remove this silly restriction.
+ trackedTunnelsLock.Lock()
+ tt := make([]string, 0, len(trackedTunnels))
+ for t := range trackedTunnels {
+ tt = append(tt, t)
+ }
+ trackedTunnelsLock.Unlock()
+ for _, t := range tt {
+ s.Stop(t, unused)
+ }
+
+ // After that process is started -- it's somewhat asynchronous -- we install the new one.
c, err := conf.LoadFromName(tunnelName)
if err != nil {
return err
@@ -156,6 +168,11 @@ func (s *ManagerService) State(tunnelName string, state *TunnelState) error {
return nil
}
+func (s *ManagerService) GlobalState(unused uintptr, state *TunnelState) error {
+ *state = trackedTunnelsGlobalState()
+ return nil
+}
+
func (s *ManagerService) Create(tunnelConfig conf.Config, tunnel *Tunnel) error {
err := tunnelConfig.Save()
if err != nil {