How to match the async result? (dns_submit_a4 returns 0 instead of a pointer)

Michael Tokarev mjt at tls.msk.ru
Sat Feb 5 20:27:23 MSK 2011


05.02.2011 19:59, Iñaki Baz Castillo wrote:
[]
> So ok, dns_submit_a4 returns a pointer to 'struct dns_query'. Now the
> question: how can I use this pointer to match the future response
> given in a callback routine?

You can't use this pointer for anything useful, actually.
The only valid usage is to cancel the query if you know
that it's not completed yet (or else the pointer will be
invalid).  This is useful for the case when you've two
queries which are related to each other and need to wait
for just one (either) of them.  So you remember both
pointers returned by dns_submit_*(), and when first query
completes, you cancel the other using the saved pointer.

For most application it is more or less a boolean - dns_submit
returns either NULL (in case of error) or non-NULL.

/mjt


More information about the udns mailing list