summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorJakob Borg <jakob@nym.se>2014-06-07 04:00:46 +0200
committerJakob Borg <jakob@nym.se>2014-06-07 04:00:46 +0200
commitdf381fd03fb8b399c66b22133c2fe1647a1edc03 (patch)
treeb20798236215558211929e2b99ee0cf7d6181e04 /cmd
parent5a2328d9a5f6aca1ff3609c61788d7357d81df83 (diff)
Let server side decide if restart is needed on config change
Diffstat (limited to 'cmd')
-rw-r--r--cmd/syncthing/gui.go37
1 files changed, 36 insertions, 1 deletions
diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go
index ef21e95c4f..2915bd7d42 100644
--- a/cmd/syncthing/gui.go
+++ b/cmd/syncthing/gui.go
@@ -16,6 +16,7 @@ import (
"net"
"net/http"
"path/filepath"
+ "reflect"
"runtime"
"sync"
"time"
@@ -210,9 +211,43 @@ func restPostConfig(req *http.Request) {
newCfg.GUI.Password = string(hash)
}
}
+
+ // Figure out if any changes require a restart
+
+ if len(cfg.Repositories) != len(newCfg.Repositories) {
+ configInSync = false
+ } else {
+ om := cfg.RepoMap()
+ nm := newCfg.RepoMap()
+ for id := range om {
+ if !reflect.DeepEqual(om[id], nm[id]) {
+ configInSync = false
+ break
+ }
+ }
+ }
+
+ if len(cfg.Nodes) != len(newCfg.Nodes) {
+ configInSync = false
+ } else {
+ om := cfg.NodeMap()
+ nm := newCfg.NodeMap()
+ for k := range om {
+ if _, ok := nm[k]; !ok {
+ configInSync = false
+ break
+ }
+ }
+ }
+
+ if !reflect.DeepEqual(cfg.Options, newCfg.Options) {
+ configInSync = false
+ }
+
+ // Activate and save
+
cfg = newCfg
saveConfig()
- configInSync = false
}
}