X-Git-Url: https://git.distorted.org.uk/~mdw/adns/blobdiff_plain/a586770a849bda269c885139b274979874d81282..fd5ac923aa5886e4e3fbdddbdcd5b8cb69b06318:/src/query.c diff --git a/src/query.c b/src/query.c index a5882f3..3e93fc2 100644 --- a/src/query.c +++ b/src/query.c @@ -148,6 +148,7 @@ static adns_status check_domain_name(adns_state ads, adns_queryflags flags, } adns_status adns__internal_submit(adns_state ads, adns_query *query_r, + adns_query parent, const typeinfo *typei, adns_rrtype type, vbuf *qumsg_vb, int id, adns_queryflags flags, struct timeval now, @@ -161,6 +162,8 @@ adns_status adns__internal_submit(adns_state ads, adns_query *query_r, if (!qu) { err = adns_s_nomemory; goto x_err; } *query_r= qu; + qu->parent= parent; + LIST_LINK_TAIL_PART(parent->children,qu,siblings.); memcpy(&qu->ctx,ctx,sizeof(qu->ctx)); query_submit(ads,qu, typei,qumsg_vb,id,flags,now); @@ -309,18 +312,18 @@ int adns_submit(adns_state ads, query_simple(ads,qu, owner,ol, typei,flags, now); } adns__autosys(ads,now); - adns__consistency(ads,qu,cc_entex); + adns__returning(ads,qu); return 0; x_adnsfail: adns__query_fail(qu,stat); - adns__consistency(ads,qu,cc_entex); + adns__returning(ads,qu); return 0; x_errno: r= errno; assert(r); - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); return r; } @@ -493,6 +496,10 @@ static void free_query_allocs(adns_query qu) { qu->query_dgram= 0; } +void adns__returning(adns_state ads, adns_query qu_for_caller) { + adns__consistency(ads,qu_for_caller,cc_entex); +} + void adns_cancel(adns_query qu) { adns_state ads; @@ -518,7 +525,7 @@ void adns_cancel(adns_query qu) { free_query_allocs(qu); free(qu->answer); free(qu); - adns__consistency(ads,0,cc_entex); + adns__returning(ads,0); } void adns__update_expires(adns_query qu, unsigned long ttl,