lib/config, lib/model: Warn about two-way introducer (fixes #8393) (#8395)

This commit is contained in:
Simon Frei 2022-06-20 19:36:45 +02:00 committed by GitHub
parent e071f16531
commit 3a6ebb8482
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -7,6 +7,7 @@
package config
import (
"fmt"
"sort"
)
@ -65,3 +66,10 @@ func deduplicateObservedFoldersToMap(input []ObservedFolder) map[string]Observed
return output
}
func (cfg *DeviceConfiguration) Description() string {
if cfg.Name == "" {
return fmt.Sprintf("%s", cfg.DeviceID.Short())
}
return fmt.Sprintf("%s (%s)", cfg.Name, cfg.DeviceID.Short())
}

View File

@ -1198,6 +1198,13 @@ func (m *model) ClusterConfig(deviceID protocol.DeviceID, cm protocol.ClusterCon
ccDeviceInfos[folder.ID] = info
}
for _, info := range ccDeviceInfos {
if deviceCfg.Introducer && info.local.Introducer {
l.Warnf("Remote %v is an introducer to us, and we are to them - only one should be introducer to the other, see https://docs.syncthing.net/users/introducer.html", deviceCfg.Description())
}
break
}
// Needs to happen outside of the fmut, as can cause CommitConfiguration
if deviceCfg.AutoAcceptFolders {
w, _ := m.cfg.Modify(func(cfg *config.Configuration) {