Skip to content

Commit

Permalink
lib/upnp: Disable confusing messages
Browse files Browse the repository at this point in the history
GitHub-Pull-Request: syncthing#4312
  • Loading branch information
AudriusButkevicius committed Aug 21, 2017
1 parent 3d8b4a4 commit 606fce0
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/upnp/upnp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 606fce0

Please sign in to comment.