chiark / gitweb /
Clean up parents from adns->childw (otherwise would abort/segfault).
authorian <ian>
Wed, 16 Jun 1999 23:16:24 +0000 (23:16 +0000)
committerian <ian>
Wed, 16 Jun 1999 23:16:24 +0000 (23:16 +0000)
changelog
regress/case-child.err [new file with mode: 0644]
regress/case-child.out [new file with mode: 0644]
regress/case-child.sys [new file with mode: 0644]
src/internal.h
src/query.c

index 929b0d9b095c66ae05dfbd30ceb9b56b37201505..040fc93f6db4c2a3c68c38105bdc246edefebbc9 100644 (file)
--- a/changelog
+++ b/changelog
@@ -1,3 +1,13 @@
+adns (0.3) unstable; urgency=low
+
+  Bugfixes:
+  * Clean up parents from adns->childw (otherwise would abort/segfault).
+  * In adnstest, allocate enough space for, and terminate, query types.
+  * Added TODO file.
+  
+ --
+
 adns (0.2) experimental; urgency=low
 
   Portability fixes for compilation on various platforms:
 adns (0.2) experimental; urgency=low
 
   Portability fixes for compilation on various platforms:
diff --git a/regress/case-child.err b/regress/case-child.err
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/regress/case-child.out b/regress/case-child.out
new file mode 100644 (file)
index 0000000..ab0706f
--- /dev/null
@@ -0,0 +1,5 @@
+adns debug: using nameserver 172.18.45.6
+134.76.224.195.in-addr.arpa flags 0 type 65548 PTR(checked) submitted
+134.76.224.195.in-addr.arpa flags 0 type PTR(checked): OK; nrrs=1; cname=$; owner=$; ttl=78694
+ "permutation-city.greenend.org.uk"
+rc=0
diff --git a/regress/case-child.sys b/regress/case-child.sys
new file mode 100644 (file)
index 0000000..0cd1079
--- /dev/null
@@ -0,0 +1,58 @@
+default
+:65548 134.76.224.195.in-addr.arpa
+ start 929574747.401802
+ socket type=SOCK_DGRAM
+ socket=4
+ +0.000189
+ fcntl fd=4 cmd=F_GETFL
+ fcntl=~O_NONBLOCK&...
+ +0.000080
+ fcntl fd=4 cmd=F_SETFL O_NONBLOCK|...
+ fcntl=OK
+ +0.000058
+ sendto fd=4 addr=172.18.45.6:53
+     311f0100 00010000 00000000 03313334 02373603 32323403 31393507 696e2d61
+     64647204 61727061 00000c00 01.
+ sendto=45
+ +0.000595
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.999405
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.008975
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     311f8180 00010001 00050005 03313334 02373603 32323403 31393507 696e2d61
+     64647204 61727061 00000c00 01c00c00 0c000100 01336600 22107065 726d7574
+     6174696f 6e2d6369 74790867 7265656e 656e6403 6f726702 756b0002 37360332
+     32340331 39350769 6e2d6164 64720461 72706100 00020001 00013366 00110464
+     6e733006 656c6d61 696c0263 6fc057c0 5b000200 01000133 66000704 646e7331
+     c083c05b 00020001 00013366 00070464 6e7332c0 83c05b00 02000100 01336600
+     0e036e73 32047861 7261036e 657400c0 5b000200 01000133 66000603 6e7333c0
+     c5c07e00 01000100 00149d00 04c17ae9 11c09b00 01000100 00149d00 04c17ae9
+     01c0ae00 01000100 00149d00 04c3e04c c1c0c100 01000100 0284e500 04c28fa1
+     6bc0db00 01000100 0284e500 04c28fa3 19.
+ +0.001671
+ sendto fd=4 addr=172.18.45.6:53
+     31200100 00010000 00000000 10706572 6d757461 74696f6e 2d636974 79086772
+     65656e65 6e64036f 72670275 6b000001 0001.
+ sendto=50
+ +0.000683
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000108
+ select max=5 rfds=[4] wfds=[] efds=[] to=1.997538
+ select=1 rfds=[4] wfds=[] efds=[]
+ +0.005811
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=OK addr=172.18.45.6:53
+     31208580 00010001 00020002 10706572 6d757461 74696f6e 2d636974 79086772
+     65656e65 6e64036f 72670275 6b000001 0001c00c 00010001 00015180 0004c3e0
+     4c860867 7265656e 656e6403 6f726702 756b0000 02000100 01518000 11036e73
+     300a7265 6c617469 76697479 c042c042 00020001 00015180 0006036e 7331c061
+     c05d0001 00010001 51800004 ac122d06 c07a0001 00010001 51800004 ac122d41.
+ +0.000862
+ recvfrom fd=4 buflen=512 *addrlen=16
+ recvfrom=EAGAIN
+ +0.000193
+ close fd=4
+ close=OK
+ +0.000207
index 5a58f9585454f07eff690b8da91c945988667516..7d527b2664ae0fc4ae9a82f158ee551dd926f28a 100644 (file)
@@ -213,8 +213,11 @@ struct adns__query {
    *  tcpsent timew   null   >=0  irrelevant     zero        any
    *                             
    *  child   childw  set    >=0  irrelevant     irrelevant  irrelevant
    *  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
    *
    *  done    output  null   -1   irrelevant     irrelevant  irrelevant
    *
+   * Queries are only not on a queue when they are actually being processed.
+   *
    *                         +------------------------+
    *             START -----> |      udp/NONE          |
    *                         +------------------------+
    *                         +------------------------+
    *             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.
  * 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);
  */
 
 void adns__search_next(adns_state ads, adns_query qu, struct timeval now);
index 2302c811705f630a49ed29ef6a29af6eab11c726..b9860bf0ab7d1cc295cd85915cc59382d9ce3598 100644 (file)
@@ -437,6 +437,7 @@ void adns__query_done(adns_query qu) {
   parent= qu->parent;
   if (parent) {
     LIST_UNLINK_PART(parent->children,qu,siblings.);
   parent= qu->parent;
   if (parent) {
     LIST_UNLINK_PART(parent->children,qu,siblings.);
+    if (!parent->children.head) LIST_UNLINK(qu->ads->childw,parent);
     qu->ctx.callback(parent,qu);
     free_query_allocs(qu);
     free(qu);
     qu->ctx.callback(parent,qu);
     free_query_allocs(qu);
     free(qu);