Merge pull request #11421 from tymoteuszblochmobica/dns_cache

Dns synchronous cache fix
pull/11464/head
Martin Kojtal 2019-09-11 14:44:32 +02:00 committed by GitHub
commit 2cd10fc786
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -187,6 +187,7 @@ Case cases[] = {
Case("ASYNCHRONOUS_DNS", ASYNCHRONOUS_DNS), Case("ASYNCHRONOUS_DNS", ASYNCHRONOUS_DNS),
Case("ASYNCHRONOUS_DNS_SIMULTANEOUS", ASYNCHRONOUS_DNS_SIMULTANEOUS), Case("ASYNCHRONOUS_DNS_SIMULTANEOUS", ASYNCHRONOUS_DNS_SIMULTANEOUS),
Case("ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE", ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE), Case("ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE", ASYNCHRONOUS_DNS_SIMULTANEOUS_CACHE),
Case("SYNCHRONOUS_DNS_CACHE", SYNCHRONOUS_DNS_CACHE),
#ifndef MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES #ifndef MBED_CONF_CELLULAR_OFFLOAD_DNS_QUERIES
Case("ASYNCHRONOUS_DNS_CACHE", ASYNCHRONOUS_DNS_CACHE), Case("ASYNCHRONOUS_DNS_CACHE", ASYNCHRONOUS_DNS_CACHE),
#endif #endif

View File

@ -40,7 +40,7 @@ void SYNCHRONOUS_DNS_CACHE()
for (unsigned int i = 0; i < 5; i++) { for (unsigned int i = 0; i < 5; i++) {
SocketAddress address; SocketAddress address;
int started_us = ticker_us; int started_us = ticker_us;
nsapi_error_t err = get_interface()->gethostbyname(dns_test_hosts_second[0], &address); nsapi_error_t err = get_interface()->gethostbyname(dns_test_hosts[0], &address);
int delay_ms = (ticker_us - started_us) / 1000; int delay_ms = (ticker_us - started_us) / 1000;
@ -49,6 +49,6 @@ void SYNCHRONOUS_DNS_CACHE()
TEST_ASSERT_TRUE(i == 0 || delay_ms <= delay_first); TEST_ASSERT_TRUE(i == 0 || delay_ms <= delay_first);
printf("DNS: query \"%s\" => \"%s\", time %i ms\n", printf("DNS: query \"%s\" => \"%s\", time %i ms\n",
dns_test_hosts_second[0], address.get_ip_address(), delay_ms); dns_test_hosts[0], address.get_ip_address(), delay_ms);
} }
} }