Explorar o código

Merge pull request #2574 from wkennington/master.upnp

upnp: Use a separate error for the error unmarshalling
Audrius Butkevicius %!s(int64=10) %!d(string=hai) anos
pai
achega
f4642e9e66
Modificáronse 1 ficheiros con 3 adicións e 3 borrados
  1. 3 3
      lib/upnp/upnp.go

+ 3 - 3
lib/upnp/upnp.go

@@ -531,9 +531,9 @@ func (s *IGDService) AddPortMapping(localIPAddress string, protocol Protocol, ex
 	if err != nil && timeout > 0 {
 		// Try to repair error code 725 - OnlyPermanentLeasesSupported
 		envelope := &soapErrorResponse{}
-		err = xml.Unmarshal(response, envelope)
-		if err != nil {
-			return err
+		err2 := xml.Unmarshal(response, envelope)
+		if err2 != nil {
+			return err2
 		}
 		if envelope.ErrorCode == 725 {
 			return s.AddPortMapping(localIPAddress, protocol, externalPort, internalPort, description, 0)