]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
- Bug #1356: Close open DNS sockets when doing idnsShutdown. Leaving them
authorrousskov <>
Tue, 10 Apr 2007 23:42:43 +0000 (23:42 +0000)
committerrousskov <>
Tue, 10 Apr 2007 23:42:43 +0000 (23:42 +0000)
  open may result in an idnsVCClosed callback being called when the name
  servers array have been freed by idnsFreeNameservers.
  (based on Christos Tsantilas and Guido Serassio work)

src/dns_internal.cc

index 2b0f43cd4becbdbdeeee0247e8c0c468362fb516..e7d88238ebdc51157009ec90cf85ffbe89769665 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: dns_internal.cc,v 1.94 2006/09/19 07:56:57 adrian Exp $
+ * $Id: dns_internal.cc,v 1.95 2007/04/10 17:42:43 rousskov Exp $
  *
  * DEBUG: section 78    DNS lookups; interacts with lib/rfc1035.c
  * AUTHOR: Duane Wessels
@@ -1271,6 +1271,13 @@ idnsShutdown(void)
 
     DnsSocket = -1;
 
+    for (int i = 0; i < nns; i++) {
+        if (nsvc *vc = nameservers[i].vc) {
+            if (vc->fd >= 0)
+                comm_close(vc->fd);
+        }
+    }
+
     idnsFreeNameservers();
 
     idnsFreeSearchpath();