Skip to main content

Name

dns_cache_lookup_wait — Perform a blocking DNS lookup, utilizing the cache

Synopsis

#include "dns-cache.h"

| dns_cache_cachenode * **dns_cache_lookup_wait** ( | query); |   |

dns_cache_query * <var class="pdparam">query</var>;

Description

Perform a blocking DNS lookup, utilizing the cache.

Parameters

query

The dns cache query. A pointer to a dns_cache_query struct. For documentation of this data structure see “dns_cache_query”

Return Values

This function returns a reference to a dns_cache_cachenode if present, or NULL if not present. If the answer for a query is present in the cache, this function will return the cache node. If the answer is not present, it will submit the query and block until the answer is available. For documentation of this data structure see “dns_cache_cachenode”.

Note

If the cachenode is returned, it is the caller's responsibility to release its reference by calling dns_cache_free_node when it has finished using it.

Threading

It is legal to call this function in any thread but should not be called in the Scheduler thread.

Note

This function may induce IO blocking or otherwise block the caller. Blocking in the scheduler thread will lead to degraded performance and should be avoided at all costs. If your code is running in the IO subsystem, the core will have already taken steps to ensure that blocking is acceptable. Otherwise, you should look at using the thread pool API to run a job in the IO pool.

See Also

Was this page helpful?