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

Iñaki Baz Castillo ibc at aliax.net
Sat Feb 5 20:39:42 MSK 2011


2011/2/5 Michael Tokarev <mjt at tls.msk.ru>:
>> 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.

Got it, thanks a lot.



-- 
Iñaki Baz Castillo
<ibc at aliax.net>


More information about the udns mailing list