mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 22:58:25 +00:00
parent
1f8e6c55f6
commit
d9cb7e2739
@ -601,14 +601,25 @@ func (s *service) CommitConfiguration(from, to config.Configuration) bool {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, ok := s.listeners[addr]; ok {
|
uri, err := url.Parse(addr)
|
||||||
seen[addr] = struct{}{}
|
if err != nil {
|
||||||
|
l.Warnf("Skipping malformed listener URL %q: %v", addr, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
uri, err := url.Parse(addr)
|
// Make sure we always have the canonical representation of the URL.
|
||||||
if err != nil {
|
// This is for consistency as we use it as a map key, but also to
|
||||||
l.Infof("Parsing listener address %s: %v", addr, err)
|
// avoid misunderstandings. We do not just use the canonicalized
|
||||||
|
// version, because an URL that looks very similar to a human might
|
||||||
|
// mean something entirely different to the computer (e.g.,
|
||||||
|
// tcp:/127.0.0.1:22000 in fact being equivalent to tcp://:22000).
|
||||||
|
if canonical := uri.String(); canonical != addr {
|
||||||
|
l.Warnf("Skipping malformed listener URL %q (not canonical)", addr)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, ok := s.listeners[addr]; ok {
|
||||||
|
seen[addr] = struct{}{}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user