Don't print garbage values on failure

This commit is contained in:
Arran Cudbard-Bell 2014-05-13 21:04:14 +01:00
parent b9362f32a7
commit 0490d16221
1 changed files with 7 additions and 8 deletions

View File

@ -251,13 +251,13 @@ static void SetRedirectAndTest(struct UPNPUrls * urls,
return;
}
UPNP_GetExternalIPAddress(urls->controlURL,
r = UPNP_GetExternalIPAddress(urls->controlURL,
data->first.servicetype,
externalIPAddress);
if(externalIPAddress[0])
printf("ExternalIPAddress = %s\n", externalIPAddress);
else
if(r!=UPNPCOMMAND_SUCCESS)
printf("GetExternalIPAddress failed.\n");
else
printf("ExternalIPAddress = %s\n", externalIPAddress);
if (addAny) {
r = UPNP_AddAnyPortMapping(urls->controlURL, data->first.servicetype,
@ -285,8 +285,7 @@ static void SetRedirectAndTest(struct UPNPUrls * urls,
if(r!=UPNPCOMMAND_SUCCESS)
printf("GetSpecificPortMappingEntry() failed with code %d (%s)\n",
r, strupnperror(r));
if(intClient[0]) {
else {
printf("InternalIP:Port = %s:%s\n", intClient, intPort);
printf("external %s:%s %s is redirected to internal %s:%s (duration=%s)\n",
externalIPAddress, eport, proto, intClient, intPort, duration);