diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go
index 18c4ac164..6409c9da1 100644
--- a/cmd/syncthing/main.go
+++ b/cmd/syncthing/main.go
@@ -630,7 +630,7 @@ func syncthingMain() {
m.StartDeadlockDetector(time.Duration(it) * time.Second)
}
} else if !IsRelease || IsBeta {
- m.StartDeadlockDetector(20 * 60 * time.Second)
+ m.StartDeadlockDetector(20 * time.Minute)
}
// Clear out old indexes for other devices. Otherwise we'll start up and
@@ -674,10 +674,13 @@ func syncthingMain() {
// Start the relevant services
connectionSvc := newConnectionSvc(cfg, myID, m, tlsCfg)
- relaySvc = relay.NewSvc(cfg, tlsCfg, connectionSvc.conns)
- connectionSvc.Add(relaySvc)
mainSvc.Add(connectionSvc)
+ if opts.GlobalAnnEnabled || opts.RelayWithoutGlobalAnn {
+ relaySvc = relay.NewSvc(cfg, tlsCfg, connectionSvc.conns)
+ connectionSvc.Add(relaySvc)
+ }
+
// Start discovery
localPort := addr.Port
diff --git a/lib/config/config.go b/lib/config/config.go
index 786068832..289ba1569 100644
--- a/lib/config/config.go
+++ b/lib/config/config.go
@@ -224,6 +224,7 @@ type OptionsConfiguration struct {
MaxRecvKbps int `xml:"maxRecvKbps" json:"maxRecvKbps"`
ReconnectIntervalS int `xml:"reconnectionIntervalS" json:"reconnectionIntervalS" default:"60"`
RelayReconnectIntervalM int `xml:"relayReconnectIntervalM" json:"relayReconnectIntervalM" default:"10"`
+ RelayWithoutGlobalAnn bool `xml:"relayWithoutGlobalAnn" json:"relayWithoutGlobalAnn" default:"false"`
StartBrowser bool `xml:"startBrowser" json:"startBrowser" default:"true"`
UPnPEnabled bool `xml:"upnpEnabled" json:"upnpEnabled" default:"true"`
UPnPLeaseM int `xml:"upnpLeaseMinutes" json:"upnpLeaseMinutes" default:"60"`
diff --git a/lib/config/config_test.go b/lib/config/config_test.go
index e9c41075e..ac741e518 100644
--- a/lib/config/config_test.go
+++ b/lib/config/config_test.go
@@ -42,6 +42,7 @@ func TestDefaultValues(t *testing.T) {
MaxRecvKbps: 0,
ReconnectIntervalS: 60,
RelayReconnectIntervalM: 10,
+ RelayWithoutGlobalAnn: false,
StartBrowser: true,
UPnPEnabled: true,
UPnPLeaseM: 60,
@@ -155,6 +156,7 @@ func TestOverriddenValues(t *testing.T) {
MaxRecvKbps: 2341,
ReconnectIntervalS: 6000,
RelayReconnectIntervalM: 20,
+ RelayWithoutGlobalAnn: true,
StartBrowser: false,
UPnPEnabled: false,
UPnPLeaseM: 90,
diff --git a/lib/config/testdata/overridenvalues.xml b/lib/config/testdata/overridenvalues.xml
index c6d026fd1..c9e06e530 100755
--- a/lib/config/testdata/overridenvalues.xml
+++ b/lib/config/testdata/overridenvalues.xml
@@ -14,6 +14,7 @@
2341
6000
20
+ true
false
false
90