mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-19 19:45:12 +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
|
var replicationDestinations []string
|
||||||
parts := strings.Split(replicationPeers, ",")
|
parts := strings.Split(replicationPeers, ",")
|
||||||
for _, part := range parts {
|
for _, part := range parts {
|
||||||
fields := strings.Split(part, "@")
|
if part == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
fields := strings.Split(part, "@")
|
||||||
switch len(fields) {
|
switch len(fields) {
|
||||||
case 2:
|
case 2:
|
||||||
// This is an id@address specification. Grab the address for the
|
// This is an id@address specification. Grab the address for the
|
||||||
@ -137,6 +140,9 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln("Parsing device ID:", err)
|
log.Fatalln("Parsing device ID:", err)
|
||||||
}
|
}
|
||||||
|
if id == protocol.EmptyDeviceID {
|
||||||
|
log.Fatalf("Missing device ID for peer in %q", part)
|
||||||
|
}
|
||||||
allowedReplicationPeers = append(allowedReplicationPeers, id)
|
allowedReplicationPeers = append(allowedReplicationPeers, id)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user