X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=adns.git;a=blobdiff_plain;f=src%2Freply.c;h=246d52d44fe0a796018b0b15666be9710909fbe6;hp=7db623b9d5d92e4b2fcb092766a7020dc4151a1f;hb=914a5ff5342e43d8a2378b1f0f65057ef084fe20;hpb=05db5bce3d0a63ce41ecf70587fcbb64e6dc9b8f diff --git a/src/reply.c b/src/reply.c index 7db623b..246d52d 100644 --- a/src/reply.c +++ b/src/reply.c @@ -3,7 +3,12 @@ * - main handling and parsing routine for received datagrams */ /* - * This file is part of adns, which is Copyright (C) 1997-1999 Ian Jackson + * This file is + * Copyright (C) 1997-1999 Ian Jackson + * + * It is part of adns, which is + * Copyright (C) 1997-1999 Ian Jackson + * Copyright (C) 1999 Tony Finch * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -80,7 +85,7 @@ void adns__procdgram(adns_state ads, const byte *dgram, int dglen, qdcount); return; } - for (qu= ads->timew.head; qu; qu= nqu) { + for (qu= viatcp ? ads->tcpw.head : ads->udpw.head; qu; qu= nqu) { nqu= qu->next; if (qu->id != id) continue; if (dglen < qu->query_dglen) continue; @@ -89,9 +94,9 @@ void adns__procdgram(adns_state ads, const byte *dgram, int dglen, qu->query_dglen-DNS_HDRSIZE)) continue; if (viatcp) { - if (qu->state != query_tcpsent) continue; + assert(qu->state == query_tcpw); } else { - if (qu->state != query_tosend) continue; + assert(qu->state == query_tosend); if (!(qu->udpsent & (1<query_dglen; arstart= -1; - LIST_UNLINK(ads->timew,qu); + if (viatcp) LIST_UNLINK(ads->tcpw,qu); + else LIST_UNLINK(ads->udpw,qu); /* We're definitely going to do something with this query now */ switch (rcode) { @@ -313,7 +319,7 @@ void adns__procdgram(adns_state ads, const byte *dgram, int dglen, /* This may have generated some child queries ... */ if (qu->children.head) { - qu->state= query_child; + qu->state= query_childw; LIST_LINK_TAIL(ads->childw,qu); return; } @@ -344,7 +350,8 @@ void adns__procdgram(adns_state ads, const byte *dgram, int dglen, memcpy(newquery,qu->vb.buf,qu->vb.used); } - if (qu->state == query_tcpsent) qu->state= query_tosend; + if (qu->state == query_tcpw) qu->state= query_tosend; + qu->retries= 0; adns__reset_preserved(qu); adns__query_send(qu,now); }