]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
only set the DNS socket read handler when we have outstanding queries,
authorwessels <>
Tue, 27 Apr 1999 04:34:06 +0000 (04:34 +0000)
committerwessels <>
Tue, 27 Apr 1999 04:34:06 +0000 (04:34 +0000)
instead of having it set all the time

src/dns_internal.cc

index af0b81998b1eb599b3514e631b9c3efacbc17b28..57ecfa3f58b95ba31822cd4c355c00618709c502 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: dns_internal.cc,v 1.12 1999/04/19 07:16:29 wessels Exp $
+ * $Id: dns_internal.cc,v 1.13 1999/04/26 22:34:06 wessels Exp $
  *
  * DEBUG: section 78    DNS lookups; interacts with lib/rfc1035.c
  * AUTHOR: Duane Wessels
@@ -192,6 +192,7 @@ idnsSendQuery(idns_query * q)
            DnsSocket, xstrerror());
     } else {
        fd_bytes(DnsSocket, x, FD_WRITE);
+       commSetSelect(DnsSocket, COMM_SELECT_READ, idnsRead, NULL, 0);
     }
     q->nsends++;
     q->sent_t = current_time;
@@ -275,7 +276,6 @@ idnsRead(int fd, void *data)
     int max = 10;
     static char rbuf[512];
     int ns;
-    commSetSelect(fd, COMM_SELECT_READ, idnsRead, NULL, 0);
     while (max--) {
        from_len = sizeof(from);
        memset(&from, '\0', from_len);
@@ -312,6 +312,8 @@ idnsRead(int fd, void *data)
        nameservers[ns].nreplies++;
        idnsGrokReply(rbuf, len);
     }
+    if (lru_list.head)
+       commSetSelect(DnsSocket, COMM_SELECT_READ, idnsRead, NULL, 0);
 }
 
 static void
@@ -361,7 +363,6 @@ idnsInit(void)
        if (DnsSocket < 0)
            fatal("Could not create a DNS socket");
        debug(78, 1) ("DNS Socket created on FD %d\n", DnsSocket);
-       commSetSelect(DnsSocket, COMM_SELECT_READ, idnsRead, NULL, 0);
     }
     if (nns == 0)
        idnsParseResolvConf();