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-transport
Commits
ccacd9f8
Commit
ccacd9f8
authored
Jan 22, 2018
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle all possible port configurations when creating dialers
parent
1504b206
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
dial.go
dial.go
+7
-4
No files found.
dial.go
View file @
ccacd9f8
...
@@ -87,10 +87,13 @@ func (n *network) makeDialer(network string) dialer {
...
@@ -87,10 +87,13 @@ func (n *network) makeDialer(network string) dialer {
// How many ports are we listening on.
// How many ports are we listening on.
var
port
=
0
var
port
=
0
for
l
:=
range
n
.
listeners
{
for
l
:=
range
n
.
listeners
{
if
port
==
0
{
newPort
:=
l
.
Addr
()
.
(
*
net
.
TCPAddr
)
.
Port
port
=
l
.
Addr
()
.
(
*
net
.
TCPAddr
)
.
Port
switch
{
}
else
{
case
newPort
==
0
:
// Any port, ignore (really, we shouldn't get this case...).
// > 1
case
port
==
0
:
// Haven't selected a port yet, choose this one.
port
=
newPort
case
newPort
==
port
:
// Same as the selected port, continue...
default
:
// Multiple ports, use the multi dialer
return
newMultiDialer
(
unspec
,
n
.
listeners
)
return
newMultiDialer
(
unspec
,
n
.
listeners
)
}
}
}
}
...
...
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