Merge pull request #2963 from bulislaw/master

DNS: Fix return value for successful name resolutions
pull/1306/merge
Martin Kojtal 2016-10-10 09:41:41 +01:00 committed by GitHub
commit d6389a4b8b
1 changed files with 6 additions and 3 deletions

View File

@ -217,7 +217,7 @@ static int nsapi_dns_query_multiple(NetworkStack *stack, const char *host,
return NSAPI_ERROR_NO_MEMORY;
}
int result = NSAPI_ERROR_DNS_FAILURE;
int result = NSAPI_ERROR_OK;
// check against each dns server
for (unsigned i = 0; i < DNS_SERVERS_SIZE; i++) {
@ -243,8 +243,11 @@ static int nsapi_dns_query_multiple(NetworkStack *stack, const char *host,
}
const uint8_t *response = packet;
dns_scan_response(&response, addr, addr_count);
break;
if (!dns_scan_response(&response, addr, addr_count)) {
result = NSAPI_ERROR_DNS_FAILURE;
} else {
break;
}
}
// clean up packet