IO->DNSStatus = status;
if (status == ARES_SUCCESS)
IO->DNS_CB(arg, abuf, alen);
+ else
+ IO->DNSStatus = status;
/// ev_io_stop(event_base, &IO->dns_io_event);
-
- IO->PostDNS(IO);
+
+ ev_timer_init(&IO->unwind_stack_timeout,
+ IO_postdns_callback, 0.0, 0);
+ IO->unwind_stack_timeout.data = IO;
+ ev_timer_start(event_base, &IO->unwind_stack_timeout);
}
-int QueueQuery(ns_type Type, char *name, AsyncIO *IO, IO_CallBack PostDNS)
+void QueryCbDone(AsyncIO *IO)
{
- int length, family;
- char address_b[sizeof(struct in6_addr)];
- int optmask = 0;
+ ev_timer_stop(event_base, &IO->unwind_stack_timeout);
+}
+
+void InitC_ares_dns(AsyncIO *IO)
+{
+ int optmask = 0;
if (IO->DNSChannel == NULL) {
optmask |= ARES_OPT_SOCK_STATE_CB;
IO->DNSOptions.sock_state_cb = SockStateCb;
IO->DNSOptions.sock_state_cb_data = IO;
ares_init_options(&IO->DNSChannel, &IO->DNSOptions, optmask);
}
+}
+int QueueQuery(ns_type Type, char *name, AsyncIO *IO, IO_CallBack PostDNS)
+{
+ int length, family;
+ char address_b[sizeof(struct in6_addr)];
+ InitC_ares_dns(IO);
IO->PostDNS = PostDNS;
switch(Type) {
case ns_t_a: