Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DNS tests: Cancel asynchronous dns query if it times out #11936

Merged
merged 1 commit into from Nov 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion TESTS/netsocket/dns/asynchronous_dns_non_async_and_async.cpp
Expand Up @@ -30,6 +30,7 @@ void ASYNCHRONOUS_DNS_NON_ASYNC_AND_ASYNC()
rtos::Semaphore semaphore;
dns_application_data data;
data.semaphore = &semaphore;
data.result = NSAPI_ERROR_TIMEOUT;

nsapi_dns_reset();

Expand All @@ -49,7 +50,9 @@ void ASYNCHRONOUS_DNS_NON_ASYNC_AND_ASYNC()
TEST_ASSERT(strlen(addr.get_ip_address()) > 1);
}

semaphore.try_acquire_for(100);
if (!semaphore.try_acquire_for(1000)) {
get_interface()->gethostbyname_async_cancel(err);
}

TEST_ASSERT_EQUAL(NSAPI_ERROR_OK, data.result);

Expand Down