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
dms3
go-unixfs
Commits
60cecefc
Commit
60cecefc
authored
Jan 19, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p/net/conn: log when reuse fails
parent
9062b9fe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
p2p/net/conn/dial.go
p2p/net/conn/dial.go
+3
-2
No files found.
p2p/net/conn/dial.go
View file @
60cecefc
...
...
@@ -91,11 +91,12 @@ func (d *Dialer) rawConnDial(ctx context.Context, raddr ma.Multiaddr, remote pee
if
laddr
!=
nil
{
// dial using reuseport.Dialer, because we're probably reusing addrs.
// this is optimistic, as the reuseDial may fail to bind the port.
log
.
Debugf
(
"trying to reuse: %s"
,
laddr
)
if
nconn
,
err
:=
d
.
reuseDial
(
laddr
,
raddr
);
err
==
nil
{
// if it worked, wrap the raw net.Conn with our manet.Conn
log
.
Debugf
(
"reuse worked! %s %s %s"
,
laddr
,
nconn
.
RemoteAddr
(),
nconn
)
log
.
Debugf
(
"
%s
reuse worked! %s %s %s"
,
d
.
LocalPeer
,
laddr
,
nconn
.
RemoteAddr
(),
nconn
)
return
manet
.
WrapNetConn
(
nconn
)
}
else
{
log
.
Debugf
(
"%s port reuse failed: %s %s"
,
d
.
LocalPeer
,
laddr
,
err
)
}
// if not, we fall back to regular Dial without a local addr specified.
}
...
...
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