dns_cache_lookup_wait — Perform a blocking DNS lookup, utilizing the cache
dns_cache_cachenode * **dns_cache_lookup_wait** ( | query
); | |
Perform a blocking DNS lookup, utilizing the cache.
The dns cache query. A pointer to a dns_cache_query struct. For documentation of this data structure see “dns_cache_query”
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”.
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.
It is legal to call this function in any thread but should not be called in the Scheduler thread.
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.