Bläddra i källkod

Make the restart on wakeup configurable

Jakob Borg 11 år sedan
förälder
incheckning
13602b6769
4 ändrade filer med 7 tillägg och 1 borttagningar
  1. 3 1
      cmd/syncthing/main.go
  2. 1 0
      config/config.go
  3. 2 0
      config/config_test.go
  4. 1 0
      config/testdata/overridenvalues.xml

+ 3 - 1
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()

+ 1 - 0
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:"-"`

+ 2 - 0
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)

+ 1 - 0
config/testdata/overridenvalues.xml

@@ -15,5 +15,6 @@
         <upnpEnabled>false</upnpEnabled>
         <upnpLeaseMinutes>60</upnpLeaseMinutes>
         <upnpRenewalMinutes>15</upnpRenewalMinutes>
+        <restartOnWakeup>false</restartOnWakeup>
     </options>
 </configuration>