How to use "dns_new()" (I get "dns_new: Assertion `(copy->dnsc_flags & DNS_INITED)' failed")

Michael Tokarev mjt at tls.msk.ru
Sat Feb 5 20:32:14 MSK 2011


05.02.2011 00:11, Iñaki Baz Castillo wrote:
> 2011/2/4 Michael Tokarev <mjt at tls.msk.ru>:
>> The idea is that all the real initialization is done in dns_init() -- this include reading of /etc/resolv.conf, checking environment variables and so on.  This is done _only_ for the default context.
> 
> But at least in my case, in order to use a context different than the
> default one, I must also initialize the new context:
> 
>   struct dns_ctx *dns_context;
>   dns_init(NULL, 0);
>   dns_context = dns_new(NULL);
>   dns_init(dns_context, 0);
>   dns_open(dns_context);
> 
> If I omit the line "dns_init(dns_context, 0)" then it doesn't work
> well (please check my other mail with subject "Problem when non using
> default ctx" in which I report it).

dns_new() returns initialized but not open context.
In the above sequence there's no need to call dns_init()
twice.

/mjt


More information about the udns mailing list