Make the restart on wakeup configurable

This commit is contained in:
Jakob Borg 2014-09-10 22:24:53 +02:00
parent 85dba25246
commit 13602b6769
4 changed files with 7 additions and 1 deletions

View File

@ -598,7 +598,9 @@ nextRepo:
}()
}
go standbyMonitor()
if cfg.Options.RestartOnWakeup {
go standbyMonitor()
}
events.Default.Log(events.StartupComplete, nil)
go generateEvents()

View File

@ -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:"-"`

View File

@ -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)

View File

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