File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ int result_exp_timeout;
3333
3434const int EXTERNAL_THREAD_SIZE = 2048 ;
3535const int EVENT_QUEUE_SIZE = 10 ;
36+ const int MAX_TRIAL_ATTEMPTS = 15 ;
3637
3738events::EventQueue *event_queue;
3839}
@@ -66,9 +67,22 @@ void ASYNCHRONOUS_DNS_TIMEOUTS()
6667 // Depends on timing, but at least one operation shall fail to timeout
6768 TEST_ASSERT (result_exp_timeout > 0 );
6869
69- // Give event queue time to finalise before destructors
70- ThisThread::sleep_for (12000 );
71-
7270 nsapi_dns_call_in_set (0 );
71+
72+ nsapi_dns_reset ();
73+ SocketAddress address;
74+ nsapi_error_t result;
75+ int count = MAX_TRIAL_ATTEMPTS;
76+ do {
77+ result = NetworkInterface::get_default_instance ()->gethostbyname (dns_test_hosts[0 ], &address);
78+ if (result == NSAPI_ERROR_OK) {
79+ return ;
80+ }
81+ ThisThread::sleep_for (1000 );
82+ count--;
83+ } while (result != NSAPI_ERROR_OK && count);
84+
85+
7386}
7487#endif // defined(MBED_CONF_RTOS_PRESENT)
88+
You can’t perform that action at this time.
0 commit comments