libev/c-ares migration: unstack out ouf c-ares before querying new requests
[citadel.git] / citadel / modules / c-ares-dns / serv_c-ares-dns.c
index 5f8426f9894731910675c94ff78c99ce3ddd537c..de124f64b2191c4776785dcad3cfc42e2c447ee1 100644 (file)
@@ -218,9 +218,19 @@ void QueryCb(void *arg,
        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);
+}
+
+void QueryCbDone(AsyncIO *IO)
+{
+       ev_timer_stop(event_base, &IO->unwind_stack_timeout);
 }