]> Cypherpunks repositories - gostls13.git/commitdiff
net: simplify probeIPv6Stack
authorMikio Hara <mikioh.mikioh@gmail.com>
Thu, 25 Jul 2013 10:29:20 +0000 (19:29 +0900)
committerMikio Hara <mikioh.mikioh@gmail.com>
Thu, 25 Jul 2013 10:29:20 +0000 (19:29 +0900)
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/11807043

src/pkg/net/ipsock_posix.go

index 4c37616ecf861d8f0fd11b008a8c4556d11df570..37827cbb2d382d546890d9180c210184a10c1748 100644 (file)
@@ -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