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-tcp-transport
Commits
5ebce0ea
Unverified
Commit
5ebce0ea
authored
Jul 26, 2017
by
Jakub Sztandera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix source address not being set in non REUSEPORT dialer
parent
9e0ef121
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
tcp.go
tcp.go
+7
-10
No files found.
tcp.go
View file @
5ebce0ea
...
...
@@ -51,6 +51,12 @@ func (t *TcpTransport) Dialer(laddr ma.Multiaddr, opts ...tpt.DialOpt) (tpt.Dial
}
var
base
manet
.
Dialer
la
,
err
:=
manet
.
ToNetAddr
(
laddr
)
if
err
!=
nil
{
return
nil
,
err
// something wrong with laddr.
}
base
.
Dialer
.
LocalAddr
=
la
var
doReuse
bool
for
_
,
o
:=
range
opts
{
switch
o
:=
o
.
(
type
)
{
...
...
@@ -136,12 +142,6 @@ type tcpDialer struct {
}
func
(
t
*
TcpTransport
)
newTcpDialer
(
base
manet
.
Dialer
,
laddr
ma
.
Multiaddr
,
doReuse
bool
)
(
*
tcpDialer
,
error
)
{
// get the local net.Addr manually
la
,
err
:=
manet
.
ToNetAddr
(
laddr
)
if
err
!=
nil
{
return
nil
,
err
// something wrong with laddr.
}
var
pattern
mafmt
.
Pattern
if
TCP4
.
Matches
(
laddr
)
{
pattern
=
TCP4
...
...
@@ -153,10 +153,7 @@ func (t *TcpTransport) newTcpDialer(base manet.Dialer, laddr ma.Multiaddr, doReu
if
doReuse
&&
ReuseportIsAvailable
()
{
rd
:=
reuseport
.
Dialer
{
D
:
net
.
Dialer
{
LocalAddr
:
la
,
Timeout
:
base
.
Timeout
,
},
D
:
base
.
Dialer
,
}
return
&
tcpDialer
{
...
...
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