From c0a4ce52c604829f9b2b320a54bf0c41057c78ca Mon Sep 17 00:00:00 2001 From: Mikio Hara Date: Thu, 25 Jul 2013 19:29:20 +0900 Subject: [PATCH] net: simplify probeIPv6Stack R=golang-dev, dave CC=golang-dev https://golang.org/cl/11807043 --- src/pkg/net/ipsock_posix.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pkg/net/ipsock_posix.go b/src/pkg/net/ipsock_posix.go index 4c37616ecf..37827cbb2d 100644 --- a/src/pkg/net/ipsock_posix.go +++ b/src/pkg/net/ipsock_posix.go @@ -28,8 +28,8 @@ import ( // boolean value is true, kernel supports IPv6 IPv4-mapping. func probeIPv6Stack() (supportsIPv6, supportsIPv4map bool) { var probes = []struct { - la TCPAddr - ok bool + laddr TCPAddr + ok bool }{ // IPv6 communication capability {TCPAddr{IP: ParseIP("::1")}, false}, @@ -44,12 +44,11 @@ func probeIPv6Stack() (supportsIPv6, supportsIPv4map bool) { } defer closesocket(s) syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY, 0) - sa, err := probes[i].la.toAddr().sockaddr(syscall.AF_INET6) + sa, err := probes[i].laddr.sockaddr(syscall.AF_INET6) if err != nil { continue } - err = syscall.Bind(s, sa) - if err != nil { + if err := syscall.Bind(s, sa); err != nil { continue } probes[i].ok = true