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
823812a5
Commit
823812a5
authored
Mar 21, 2017
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow nil for dialer laddr
parent
f4bd862c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
tcp.go
tcp.go
+7
-7
No files found.
tcp.go
View file @
823812a5
...
...
@@ -36,6 +36,13 @@ func NewTCPTransport() *TcpTransport {
}
func
(
t
*
TcpTransport
)
Dialer
(
laddr
ma
.
Multiaddr
,
opts
...
tpt
.
DialOpt
)
(
tpt
.
Dialer
,
error
)
{
if
laddr
==
nil
{
zaddr
,
err
:=
ma
.
NewMultiaddr
(
"/ip4/0.0.0.0/tcp/0"
)
if
err
!=
nil
{
return
nil
,
err
}
laddr
=
zaddr
}
t
.
dlock
.
Lock
()
defer
t
.
dlock
.
Unlock
()
s
:=
laddr
.
String
()
...
...
@@ -176,13 +183,6 @@ func (d *tcpDialer) Dial(raddr ma.Multiaddr) (tpt.Conn, error) {
}
func
(
d
*
tcpDialer
)
DialContext
(
ctx
context
.
Context
,
raddr
ma
.
Multiaddr
)
(
tpt
.
Conn
,
error
)
{
if
raddr
==
nil
{
zaddr
,
err
:=
ma
.
NewMultiaddr
(
"/ip4/0.0.0.0/tcp/0"
)
if
err
!=
nil
{
return
nil
,
err
}
raddr
=
zaddr
}
var
c
manet
.
Conn
var
err
error
if
d
.
doReuse
{
...
...
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