Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-reuseport
Commits
a98b4c90
Commit
a98b4c90
authored
Jan 03, 2019
by
Matt Joiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for hosts that don't have localhost->::1 for IPv6
parent
ea6dd6cf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
reuse_test.go
reuse_test.go
+5
-5
No files found.
reuse_test.go
View file @
a98b4c90
...
...
@@ -9,17 +9,17 @@ import (
"github.com/stretchr/testify/require"
)
func
testDialFromListeningPort
(
t
*
testing
.
T
,
network
string
)
{
func
testDialFromListeningPort
(
t
*
testing
.
T
,
network
,
host
string
)
{
lc
:=
net
.
ListenConfig
{
Control
:
Control
,
}
ctx
:=
context
.
Background
()
ll
,
err
:=
lc
.
Listen
(
ctx
,
network
,
"local
host:0"
)
ll
,
err
:=
lc
.
Listen
(
ctx
,
network
,
host
+
"
:0"
)
if
err
!=
nil
&&
strings
.
Contains
(
err
.
Error
(),
"cannot assign requested address"
)
{
t
.
Skip
(
err
)
}
require
.
NoError
(
t
,
err
)
rl
,
err
:=
lc
.
Listen
(
ctx
,
network
,
"local
host:0"
)
rl
,
err
:=
lc
.
Listen
(
ctx
,
network
,
host
+
"
:0"
)
require
.
NoError
(
t
,
err
)
d
:=
net
.
Dialer
{
LocalAddr
:
ll
.
Addr
(),
...
...
@@ -31,9 +31,9 @@ func testDialFromListeningPort(t *testing.T, network string) {
}
func
TestDialFromListeningPort
(
t
*
testing
.
T
)
{
testDialFromListeningPort
(
t
,
"tcp"
)
testDialFromListeningPort
(
t
,
"tcp"
,
"localhost"
)
}
func
TestDialFromListeningPortTcp6
(
t
*
testing
.
T
)
{
testDialFromListeningPort
(
t
,
"tcp6"
)
testDialFromListeningPort
(
t
,
"tcp6"
,
"[::1]"
)
}
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