mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #11421 from tymoteuszblochmobica/dns_cache
Dns synchronous cache fixpull/11464/head
commit
2cd10fc786
|
@ -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
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue