From: wessels <> Date: Tue, 27 Apr 1999 04:34:06 +0000 (+0000) Subject: only set the DNS socket read handler when we have outstanding queries, X-Git-Tag: SQUID_3_0_PRE1~2242 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e6caa54f95389af6ca69774e4288e5721c6edd4;p=thirdparty%2Fsquid.git only set the DNS socket read handler when we have outstanding queries, instead of having it set all the time --- diff --git a/src/dns_internal.cc b/src/dns_internal.cc index af0b81998b..57ecfa3f58 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -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();