diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go index fc524934..65290c36 100644 --- a/cmd/syncthing/main.go +++ b/cmd/syncthing/main.go @@ -598,7 +598,9 @@ nextRepo: }() } - go standbyMonitor() + if cfg.Options.RestartOnWakeup { + go standbyMonitor() + } events.Default.Log(events.StartupComplete, nil) go generateEvents() diff --git a/config/config.go b/config/config.go index d0aa0b71..40d85ddc 100644 --- a/config/config.go +++ b/config/config.go @@ -126,6 +126,7 @@ type OptionsConfiguration struct { UPnPLease int `xml:"upnpLeaseMinutes" default:"0"` UPnPRenewal int `xml:"upnpRenewalMinutes" default:"30"` URAccepted int `xml:"urAccepted"` // Accepted usage reporting version; 0 for off (undecided), -1 for off (permanently) + RestartOnWakeup bool `xml:"restartOnWakeup" default:"true"` Deprecated_RescanIntervalS int `xml:"rescanIntervalS,omitempty" json:"-"` Deprecated_UREnabled bool `xml:"urEnabled,omitempty" json:"-"` diff --git a/config/config_test.go b/config/config_test.go index fabc1324..3d6c63be 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -37,6 +37,7 @@ func TestDefaultValues(t *testing.T) { UPnPEnabled: true, UPnPLease: 0, UPnPRenewal: 30, + RestartOnWakeup: true, } cfg := New("test", node1) @@ -128,6 +129,7 @@ func TestOverriddenValues(t *testing.T) { UPnPEnabled: false, UPnPLease: 60, UPnPRenewal: 15, + RestartOnWakeup: false, } cfg, err := Load("testdata/overridenvalues.xml", node1) diff --git a/config/testdata/overridenvalues.xml b/config/testdata/overridenvalues.xml index 967100be..7470269f 100755 --- a/config/testdata/overridenvalues.xml +++ b/config/testdata/overridenvalues.xml @@ -15,5 +15,6 @@ false 60 15 + false