mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 10:58:57 +00:00
The intention was that if no peers are given, we shouldn't start the listener. We did that anyway, because: - splitting an empty string on comma returns a slice with one empty string in it - parsing the empty string as a device ID returns the empty device ID so we end up with a valid replication peer which is the empty device ID.
This commit is contained in:
parent
9efac0f067
commit
479712cdc5
@ -116,8 +116,11 @@ func main() {
|
||||
var replicationDestinations []string
|
||||
parts := strings.Split(replicationPeers, ",")
|
||||
for _, part := range parts {
|
||||
fields := strings.Split(part, "@")
|
||||
if part == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
fields := strings.Split(part, "@")
|
||||
switch len(fields) {
|
||||
case 2:
|
||||
// This is an id@address specification. Grab the address for the
|
||||
@ -137,6 +140,9 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatalln("Parsing device ID:", err)
|
||||
}
|
||||
if id == protocol.EmptyDeviceID {
|
||||
log.Fatalf("Missing device ID for peer in %q", part)
|
||||
}
|
||||
allowedReplicationPeers = append(allowedReplicationPeers, id)
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user