X-Git-Url: https://git.distorted.org.uk/~mdw/adns/blobdiff_plain/07554ccd8286775b4f88a608ba3b94ff7b9efaf9..272c9cb36d4001cd68ff43280ffb6df6f3798f84:/src/check.c?ds=sidebyside diff --git a/src/check.c b/src/check.c index 3972ebe..e9d6771 100644 --- a/src/check.c +++ b/src/check.c @@ -78,11 +78,13 @@ static void checkc_global(adns_state ads) { const struct sortlist *sl; int i; - assert(ads->udpsocket >= 0); + assert(ads->udpsockets >= 0); for (i=0; insortlist; i++) { sl= &ads->sortlist[i]; - assert(adns__addr_match_p(sl->af,&sl->base, sl->af,&sl->base,&sl->mask)); + assert(adns__addr_matches(sl->base.sa.sa_family, + adns__sockaddr_addr(&sl->base.sa), + &sl->base,&sl->mask)); } assert(ads->tcpserver >= 0 && ads->tcpserver < ads->nservers); @@ -148,15 +150,29 @@ static void checkc_queue_childw(adns_state ads) { }); } +static void checkc_query_done(adns_state ads, adns_query qu) { + assert(qu->state == query_done); + assert(!qu->children.head && !qu->children.tail); + checkc_query(ads,qu); +} + static void checkc_queue_output(adns_state ads) { adns_query qu; DLIST_CHECK(ads->output, qu, , { - assert(qu->state == query_done); - assert(!qu->children.head && !qu->children.tail); assert(!qu->parent); assert(!qu->allocations.head && !qu->allocations.tail); - checkc_query(ads,qu); + checkc_query_done(ads,qu); + }); +} + +static void checkc_queue_intdone(adns_state ads) { + adns_query qu; + + DLIST_CHECK(ads->intdone, qu, , { + assert(qu->parent); + assert(qu->ctx.callback); + checkc_query_done(ads,qu); }); } @@ -168,6 +184,7 @@ void adns__consistency(adns_state ads, adns_query qu, consistency_checks cc) { break; case cc_entex: if (!(ads->iflags & adns_if_checkc_entex)) return; + assert(!ads->intdone.head); break; case cc_freq: if ((ads->iflags & adns_if_checkc_freq) != adns_if_checkc_freq) return; @@ -181,6 +198,7 @@ void adns__consistency(adns_state ads, adns_query qu, consistency_checks cc) { checkc_queue_tcpw(ads); checkc_queue_childw(ads); checkc_queue_output(ads); + checkc_queue_intdone(ads); if (qu) { switch (qu->state) { @@ -194,7 +212,10 @@ void adns__consistency(adns_state ads, adns_query qu, consistency_checks cc) { DLIST_ASSERTON(qu, search, ads->childw, ); break; case query_done: - DLIST_ASSERTON(qu, search, ads->output, ); + if (qu->parent) + DLIST_ASSERTON(qu, search, ads->intdone, ); + else + DLIST_ASSERTON(qu, search, ads->output, ); break; default: assert(!"specific query state");