From a4f0b85462e59c7d46743906c4785f94a1036ab7 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Sun, 3 Apr 2016 21:18:16 +0200 Subject: [PATCH] lib/config: Disable cacheIgnoredFiles, new default is disabled --- lib/config/config.go | 12 +++++++++++- lib/config/config_test.go | 4 ++-- lib/config/optionsconfiguration.go | 2 +- lib/config/testdata/overridenvalues.xml | 6 +++--- lib/config/testdata/v13.xml | 14 ++++++++++++++ 5 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 lib/config/testdata/v13.xml diff --git a/lib/config/config.go b/lib/config/config.go index 4f80fd180..097c2182a 100644 --- a/lib/config/config.go +++ b/lib/config/config.go @@ -21,7 +21,7 @@ import ( const ( OldestHandledVersion = 10 - CurrentVersion = 12 + CurrentVersion = 13 MaxRescanIntervalS = 365 * 24 * 60 * 60 ) @@ -182,6 +182,9 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) { if cfg.Version == 11 { convertV11V12(cfg) } + if cfg.Version == 12 { + convertV12V13(cfg) + } // Build a list of available devices existingDevices := make(map[protocol.DeviceID]bool) @@ -235,6 +238,13 @@ func (cfg *Configuration) prepare(myID protocol.DeviceID) { } } +func convertV12V13(cfg *Configuration) { + // Not using the ignore cache is the new default. Disable it on existing + // configurations. + cfg.Options.CacheIgnoredFiles = false + cfg.Version = 13 +} + func convertV11V12(cfg *Configuration) { // Change listen address schema for i, addr := range cfg.Options.ListenAddress { diff --git a/lib/config/config_test.go b/lib/config/config_test.go index 4480fb026..a1e682a92 100644 --- a/lib/config/config_test.go +++ b/lib/config/config_test.go @@ -51,7 +51,7 @@ func TestDefaultValues(t *testing.T) { RestartOnWakeup: true, AutoUpgradeIntervalH: 12, KeepTemporariesH: 24, - CacheIgnoredFiles: true, + CacheIgnoredFiles: false, ProgressUpdateIntervalS: 5, SymlinksEnabled: true, LimitBandwidthInLan: false, @@ -180,7 +180,7 @@ func TestOverriddenValues(t *testing.T) { RestartOnWakeup: false, AutoUpgradeIntervalH: 24, KeepTemporariesH: 48, - CacheIgnoredFiles: false, + CacheIgnoredFiles: true, ProgressUpdateIntervalS: 10, SymlinksEnabled: false, LimitBandwidthInLan: true, diff --git a/lib/config/optionsconfiguration.go b/lib/config/optionsconfiguration.go index cb469b389..1bcf56a08 100644 --- a/lib/config/optionsconfiguration.go +++ b/lib/config/optionsconfiguration.go @@ -32,7 +32,7 @@ type OptionsConfiguration struct { RestartOnWakeup bool `xml:"restartOnWakeup" json:"restartOnWakeup" default:"true"` AutoUpgradeIntervalH int `xml:"autoUpgradeIntervalH" json:"autoUpgradeIntervalH" default:"12"` // 0 for off KeepTemporariesH int `xml:"keepTemporariesH" json:"keepTemporariesH" default:"24"` // 0 for off - CacheIgnoredFiles bool `xml:"cacheIgnoredFiles" json:"cacheIgnoredFiles" default:"true"` + CacheIgnoredFiles bool `xml:"cacheIgnoredFiles" json:"cacheIgnoredFiles" default:"false"` ProgressUpdateIntervalS int `xml:"progressUpdateIntervalS" json:"progressUpdateIntervalS" default:"5"` SymlinksEnabled bool `xml:"symlinksEnabled" json:"symlinksEnabled" default:"true"` LimitBandwidthInLan bool `xml:"limitBandwidthInLan" json:"limitBandwidthInLan" default:"false"` diff --git a/lib/config/testdata/overridenvalues.xml b/lib/config/testdata/overridenvalues.xml index acbae076c..4dc2efba1 100755 --- a/lib/config/testdata/overridenvalues.xml +++ b/lib/config/testdata/overridenvalues.xml @@ -1,6 +1,6 @@ - + - :23000 + tcp://:23000 false udp4://syncthing.nym.se:22026 false @@ -24,7 +24,7 @@ false 24 48 - false + true 10 false true diff --git a/lib/config/testdata/v13.xml b/lib/config/testdata/v13.xml new file mode 100644 index 000000000..1fec6e1bd --- /dev/null +++ b/lib/config/testdata/v13.xml @@ -0,0 +1,14 @@ + + + + + 1 + -1 + + +
tcp://a
+
+ +
tcp://b
+
+