Merge pull request #5945 from kjbracey-arm/dns_multiple

Correct return value of nsapi_dns_query_multiple
pull/5966/head
Cruz Monrreal 2018-01-29 10:09:42 -06:00 committed by GitHub
commit 49cdb0bb07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -214,7 +214,7 @@ static nsapi_size_or_error_t nsapi_dns_query_multiple(NetworkStack *stack, const
socket.set_timeout(DNS_TIMEOUT);
// create network packet
uint8_t *packet = (uint8_t *)malloc(DNS_BUFFER_SIZE);
uint8_t * const packet = (uint8_t *)malloc(DNS_BUFFER_SIZE);
if (!packet) {
return NSAPI_ERROR_NO_MEMORY;
}
@ -243,8 +243,9 @@ static nsapi_size_or_error_t nsapi_dns_query_multiple(NetworkStack *stack, const
}
const uint8_t *response = packet;
if (dns_scan_response(&response, addr, addr_count) > 0) {
result = NSAPI_ERROR_OK;
int count = dns_scan_response(&response, addr, addr_count);
if (count > 0) {
result = count;
}
/* The DNS response is final, no need to check other servers */