Browse code

Vendoring miekg/dns @ 75e6e86cc601825c5dbcd4e0c209eab180997cd7

- Fixes the issue of Shutdown() not working, resulting in hung
goroutines

Signed-off-by: Santhosh Manohar <santhosh@docker.com>

Santhosh Manohar authored on 2016/01/18 01:17:13
Showing 3 changed files
... ...
@@ -43,7 +43,7 @@ fix_rewritten_imports github.com/coreos/etcd
43 43
 clone git github.com/ugorji/go 5abd4e96a45c386928ed2ca2a7ef63e2533e18ec
44 44
 clone git github.com/hashicorp/consul v0.5.2
45 45
 clone git github.com/boltdb/bolt v1.1.0
46
-clone git github.com/miekg/dns d27455715200c7d3e321a1e5cadb27c9ee0b0f02
46
+clone git github.com/miekg/dns 75e6e86cc601825c5dbcd4e0c209eab180997cd7
47 47
 
48 48
 # get graph and distribution packages
49 49
 clone git github.com/docker/distribution cb08de17d74bef86ce6c5abe8b240e282f5750be
... ...
@@ -535,6 +535,9 @@ Redo:
535 535
 	h.ServeDNS(w, req) // Writes back to the client
536 536
 
537 537
 Exit:
538
+	if w.tcp == nil {
539
+		return
540
+	}
538 541
 	// TODO(miek): make this number configurable?
539 542
 	if q > maxTCPQueries { // close socket after this many queries
540 543
 		w.Close()
... ...
@@ -24,6 +24,12 @@ func setUDPSocketOptions4(conn *net.UDPConn) error {
24 24
 	if err := syscall.SetsockoptInt(int(file.Fd()), syscall.IPPROTO_IP, syscall.IP_PKTINFO, 1); err != nil {
25 25
 		return err
26 26
 	}
27
+	// Calling File() above results in the connection becoming blocking, we must fix that.
28
+	// See https://github.com/miekg/dns/issues/279
29
+	err = syscall.SetNonblock(int(file.Fd()), true)
30
+	if err != nil {
31
+		return err
32
+	}
27 33
 	return nil
28 34
 }
29 35
 
... ...
@@ -36,6 +42,10 @@ func setUDPSocketOptions6(conn *net.UDPConn) error {
36 36
 	if err := syscall.SetsockoptInt(int(file.Fd()), syscall.IPPROTO_IPV6, syscall.IPV6_RECVPKTINFO, 1); err != nil {
37 37
 		return err
38 38
 	}
39
+	err = syscall.SetNonblock(int(file.Fd()), true)
40
+	if err != nil {
41
+		return err
42
+	}
39 43
 	return nil
40 44
 }
41 45