Browse Source

restart deamon on connect/disconnect

Matthew R. Kasun 2 years ago
parent
commit
c83d273f28
1 changed files with 3 additions and 0 deletions
  1. 3 0
      netclient/functions/connection.go

+ 3 - 0
netclient/functions/connection.go

@@ -4,6 +4,7 @@ import (
 	"fmt"
 	"fmt"
 
 
 	"github.com/gravitl/netmaker/netclient/config"
 	"github.com/gravitl/netmaker/netclient/config"
+	"github.com/gravitl/netmaker/netclient/daemon"
 	"github.com/gravitl/netmaker/netclient/ncutils"
 	"github.com/gravitl/netmaker/netclient/ncutils"
 	"github.com/gravitl/netmaker/netclient/wireguard"
 	"github.com/gravitl/netmaker/netclient/wireguard"
 )
 )
@@ -23,6 +24,7 @@ func Connect(network string) error {
 	if err = wireguard.ApplyConf(&cfg.Node, cfg.Node.Interface, filePath); err != nil {
 	if err = wireguard.ApplyConf(&cfg.Node, cfg.Node.Interface, filePath); err != nil {
 		return err
 		return err
 	}
 	}
+	daemon.Restart()
 	return config.ModNodeConfig(&cfg.Node)
 	return config.ModNodeConfig(&cfg.Node)
 }
 }
 
 
@@ -41,5 +43,6 @@ func Disconnect(network string) error {
 	if err = wireguard.ApplyConf(&cfg.Node, cfg.Node.Interface, filePath); err != nil {
 	if err = wireguard.ApplyConf(&cfg.Node, cfg.Node.Interface, filePath); err != nil {
 		return err
 		return err
 	}
 	}
+	daemon.Restart()
 	return config.ModNodeConfig(&cfg.Node)
 	return config.ModNodeConfig(&cfg.Node)
 }
 }