[ldns-users] Can ldns be used asynchronously?
McCann Peter-A001034
pete.mccann at motorola.com
Tue Aug 17 17:36:52 UTC 2010
W.C.A. Wijngaards wrote:
> Not unless you code it yourself. Libunbound
> http://unbound.net/documentation/libunbound-tutorial-4.html can do
> asynchronous queries.
Thank you, Wouter. I might switch to using libunbound.
A question, though: I note that a call to ub_ctx_async
sets whether to spawn a thread or fork a process. But,
why do I have to do either? It seems like the file
descriptor returned from ub_ctx_fd could be the UDP
socket on which the library is waiting for a response
packet. In that case, a call to ub_process would both
read this data from the socket and perform any other
processing that might be necessary. But, I guess you
would also need to return a timeout value that the
application would need to respect by calling ub_process
at that time in case no response was received.
I am just a little concerned about the overhead of
spawning a thread for each lookup.
-Pete
More information about the ldns-users
mailing list