/[svn]/ircd-hybrid-7.2/src/irc_res.c
ViewVC logotype

Diff of /ircd-hybrid-7.2/src/irc_res.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 982 by michael, Thu Aug 13 22:15:08 2009 UTC revision 984 by michael, Fri Aug 14 13:18:14 2009 UTC
# Line 454  do_query_name(struct DNSQuery *query, co Line 454  do_query_name(struct DNSQuery *query, co
454      request->type = type;      request->type = type;
455      strcpy(request->name, host_name);      strcpy(request->name, host_name);
456  #ifdef IPV6  #ifdef IPV6
457      if (type == T_A)      if (type != T_A)
       request->state = REQ_A;  
     else  
458        request->state = REQ_AAAA;        request->state = REQ_AAAA;
459  #else      else
     request->state = REQ_A;  
460  #endif  #endif
461        request->state = REQ_A;
462    }    }
463    
464    request->type = type;    request->type = type;
# Line 771  res_readreply(fde_t *fd, void *data) Line 769  res_readreply(fde_t *fd, void *data)
769     * interest where it'll instantly be ready for read :-) -- adrian     * interest where it'll instantly be ready for read :-) -- adrian
770     */     */
771    comm_setselect(fd, COMM_SELECT_READ, res_readreply, NULL, 0);    comm_setselect(fd, COMM_SELECT_READ, res_readreply, NULL, 0);
772    
773    /* Better to cast the sizeof instead of rc */    /* Better to cast the sizeof instead of rc */
774    if (rc <= (int)(sizeof(HEADER)))    if (rc <= (int)(sizeof(HEADER)))
775      return;      return;
# Line 799  res_readreply(fde_t *fd, void *data) Line 798  res_readreply(fde_t *fd, void *data)
798    
799    if ((header->rcode != NO_ERRORS) || (header->ancount == 0))    if ((header->rcode != NO_ERRORS) || (header->ancount == 0))
800    {    {
801      if (NXDOMAIN == header->rcode)      if (header->rcode == SERVFAIL || header->rcode == NXDOMAIN)
802        {
803          /*
804           * If a bad error was returned, stop here and don't
805           * send any more (no retries granted).
806           */
807          (*request->query->callback)(request->query->ptr, NULL);
808          rem_request(request);
809        }
810    #ifdef IPV6
811        else
812      {      {
813        /*        /*
814         * If we havent already tried this, and we're looking up AAAA, try A         * If we havent already tried this, and we're looking up AAAA, try A
815         * now         * now
816         */         */
 #ifdef IPV6  
817        if (request->state == REQ_AAAA && request->type == T_AAAA)        if (request->state == REQ_AAAA && request->type == T_AAAA)
818        {        {
819          request->timeout += 4;          request->timeout += 4;
# Line 819  res_readreply(fde_t *fd, void *data) Line 827  res_readreply(fde_t *fd, void *data)
827          request->retries--;          request->retries--;
828          resend_query(request);          resend_query(request);
829        }        }
       else      /* It's NXDOMAIN but not IPV6 */  
 #endif  
       {  
         /*  
          * If a bad error was returned, stop here and don't  
          * send any more (no retries granted).  
          */  
         (*request->query->callback)(request->query->ptr, NULL);  
         rem_request(request);  
       }  
     }  
     else        /* Some other error other than NXDOMAIN */  
     {  
       /*  
        * If a bad error was returned, stop here and don't  
        * send any more (no retries granted).  
        */  
       (*request->query->callback)(request->query->ptr, NULL);  
       rem_request(request);  
830      }      }
831    #endif
832    
833      return;      return;
834    }    }
835    
836    /*    /*
837     * If this fails there was an error decoding the received packet,     * If this fails there was an error decoding the received packet,
838     * try it again and hope it works the next time.     * try it again and hope it works the next time.

Legend:
Removed from v.982  
changed lines
  Added in v.984

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.26