From 2ebd387eab05c472bd95be08fbf8ce1986d012ab Mon Sep 17 00:00:00 2001 From: ian Date: Fri, 9 Aug 2013 20:51:16 +0000 Subject: net: give C.getaddrinfo a hint that we only want SOCK_STREAM answers This should be more efficient everywhere, and appears to be required on Solaris. Copied from master repository. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201637 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/go/net/cgo_unix.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libgo/go') diff --git a/libgo/go/net/cgo_unix.go b/libgo/go/net/cgo_unix.go index a4d96a86d12..ce54d827c8e 100644 --- a/libgo/go/net/cgo_unix.go +++ b/libgo/go/net/cgo_unix.go @@ -103,6 +103,7 @@ func cgoLookupIPCNAME(name string) (addrs []IP, cname string, err error, complet var hints syscall.Addrinfo hints.Ai_flags = int32(cgoAddrInfoFlags()) + hints.Ai_socktype = syscall.SOCK_STREAM h := syscall.StringBytePtr(name) syscall.Entersyscall() @@ -130,7 +131,7 @@ func cgoLookupIPCNAME(name string) (addrs []IP, cname string, err error, complet } } for r := res; r != nil; r = r.Ai_next { - // Everything comes back twice, once for UDP and once for TCP. + // We only asked for SOCK_STREAM, but check anyhow. if r.Ai_socktype != syscall.SOCK_STREAM { continue } -- cgit v1.2.1