lib/upnp: Disable confusing messages

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4312
This commit is contained in:
Audrius Butkevicius 2017-08-21 10:03:25 +00:00
parent 3d8b4a42b7
commit 606fce09ca

View File

@ -168,7 +168,9 @@ USER-AGENT: syncthing/1.0
_, err = socket.WriteTo(search, ssdp)
if err != nil {
l.Infoln(err)
if e, ok := err.(net.Error); !ok || !e.Timeout() {
l.Infoln(err)
}
return
}
@ -226,11 +228,6 @@ func parseResponse(deviceType string, resp []byte) (IGD, error) {
}
deviceUUID := strings.TrimPrefix(strings.Split(deviceUSN, "::")[0], "uuid:")
matched, _ := regexp.MatchString("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", deviceUUID)
if !matched {
l.Infoln("Invalid IGD response: invalid device UUID", deviceUUID, "(continuing anyway)")
}
response, err = http.Get(deviceDescriptionLocation)
if err != nil {
return IGD{}, err