[getdns-users] getdns_context_run() vs. getdns_context_process_async()

Willem Toorop willem at nlnetlabs.nl
Thu Apr 30 21:12:51 UTC 2015


Hi Scott,

I don't know for sure without seeing the code, but might it be that you
destroy the context right after the call to getdns_context_process_async() ?

getdns_context_process_async() just has a quick look if it can do some
callbacks immediately.  If it cannot, it will not block and exit
immediately.  When there are requests still in flight they will be
cancelled on a subsequent call to getdns_context_destroy().

If you want to process all outstanding queries, you should use
getdns_context_run().

Also getdns_context_process_async() does not work with stub requests
with libevent.  The function is a leftover from earlier asynchronous
mechanics and I would actually rather get rid of it.  Use
getdns_context_run() instead.

Cheers,
-- Willem


Op 30-04-15 om 21:21 schreef Hollenbeck, Scott:
>> -----Original Message-----
>> From: Users [mailto:users-bounces at getdnsapi.net] On Behalf Of Willem
>> Toorop
>> Sent: Thursday, April 30, 2015 8:31 AM
>> To: users at getdnsapi.net
>> Subject: Re: [getdns-users] getdns_context_run() vs.
>> getdns_context_process_async()
>>
>> Hi Scott,
>>
>> getdns_context_run() blocks and runs the event loop until there is
>> nothing more to process.
>>
>> getdns_context_process_async() does not block, but has a quick look to
>> see if queries have been received, and if so does the callbacks.  Then
>> it looks if events have a timed out, and if so does those callbacks
>> too.
>>
>> Note that getdns_context_process_async() does not work with stub
>> requests with libevent.  Although I can see some potential use cases
>> for
>> getdns_context_process_async(), I would rather get rid of it.
> 
> Thanks, Willem. Should I expect to see a different callback_type value in my callback function if I call one versus the other?  I'm asking because while running through my PHP test cases I found that calling getdns_context_run() gave me a callback_type of 700 (GETDNS_CALLBACK_COMPLETE). Calling getdns_context_process_async() gave me a callback_type of 701 (GETDNS_CALLBACK_CANCEL). Is this expected behavior?
> 
> Thanks,
> Scott
> 
> _______________________________________________
> Users mailing list
> Users at getdnsapi.net
> http://getdnsapi.net/mailman/listinfo/users
> 




More information about the Users mailing list