Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
c0a4ce52
Commit
c0a4ce52
authored
Jul 25, 2013
by
Mikio Hara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net: simplify probeIPv6Stack
R=golang-dev, dave CC=golang-dev
https://golang.org/cl/11807043
parent
085159da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
src/pkg/net/ipsock_posix.go
src/pkg/net/ipsock_posix.go
+4
-5
No files found.
src/pkg/net/ipsock_posix.go
View file @
c0a4ce52
...
...
@@ -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
la
ddr
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
]
.
la
ddr
.
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment