[getdns-api] getdns_return_t for destroy methods

Paul Hoffman paul.hoffman at vpnc.org
Mon Mar 10 10:04:04 MST 2014


On Mar 10, 2014, at 12:30 PM, Willem Toorop <willem at nlnetlabs.nl> wrote:

> op 10-03-14 08:51, Paul Hoffman schreef:
>> On Mar 9, 2014, at 8:45 PM, Goyal, Neel <ngoyal at verisign.com> wrote:
>>> 
>>> getdns_return_t getdns_context_destroy(struct getdns_context* context);
>>> 
>>> Returns GETDNS_RETURN_GOOD if the context was successfully destroyed.  In the event that the context cannot be destroyed, GETDNS_RETURN_GENERIC_ERROR is returned.  Some implementations may return this if getdns_context_destroy is called within a getdns_callback_t.
>> 
>> "Some implementations"? Can any implementation destroy the context within the callback?
> 
> The implementation can not.  But, the application using the
> implementation/library *can* do it from within a callback, because the
> callbacks are part of that application.
> 
> What we propose, is to let a getdns_context_destroy, when used from
> within a callback, return GETDNS_RETURN_GOOD if the
> library/implementation can deal with it, and GETDNS_RETURN_GENERIC_ERROR
> if it can not.
> 
> Our implementation currently deals with it, but it is administratively
> cumbersome (implementation wise) and therefore susceptible for bugs in
> the future.  For robustness we would rather disallow it.

OK, that makes more sense. How about this instead:

getdns_return_t getdns_context_destroy(struct getdns_context* context);

Returns destroys the context and GETDNS_RETURN_GOOD if the context exists.  If the context does not exist (for example, because it was previously destroyed), the function returns GETDNS_RETURN_GENERIC_ERROR.

--Paul Hoffman


More information about the getdns-api mailing list