X-Git-Url: https://git.distorted.org.uk/~mdw/adns/blobdiff_plain/22181a31434b2439e41200ec65a95cb8605d41f5..9da4a044c4d2e0a960cf8f33c62774db02f4402d:/src/internal.h diff --git a/src/internal.h b/src/internal.h index 5a58f95..b813215 100644 --- a/src/internal.h +++ b/src/internal.h @@ -213,8 +213,11 @@ struct adns__query { * tcpsent timew null >=0 irrelevant zero any * * child childw set >=0 irrelevant irrelevant irrelevant + * child NONE null >=0 irrelevant irrelevant irrelevant * done output null -1 irrelevant irrelevant irrelevant * + * Queries are only not on a queue when they are actually being processed. + * * +------------------------+ * START -----> | udp/NONE | * +------------------------+ @@ -378,6 +381,17 @@ adns_status adns__internal_submit(adns_state ads, adns_query *query_r, * succeeds or fails (if it succeeds, the vbuf is reused for qu->vb). * * *ctx is copied byte-for-byte into the query. + * + * When the child query is done, ctx->callback will be called. The + * child will already have been taken off both the global list of + * queries in ads and the list of children in the parent. The child + * will be freed when the callback returns. The parent will have been + * taken off the global childw queue iff this is the last child for + * that parent. If there is no error detected in the callback, then + * it should call adns__query_done if and only if there are no more + * children (by checking parent->children.head). If an error is + * detected in the callback it should call adns__query_fail and any + * remaining children will automatically be cancelled. */ void adns__search_next(adns_state ads, adns_query qu, struct timeval now); @@ -604,7 +618,7 @@ static inline void timevaladd(struct timeval *tv_io, long ms) { static inline int ctype_whitespace(int c) { return c==' ' || c=='\n' || c=='\t'; } static inline int ctype_digit(int c) { return c>='0' && c<='9'; } static inline int ctype_alpha(int c) { - return (c >= 'a' && c <= 'z') || (c >= 'A' || c <= 'Z'); + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); } /* Useful macros */