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-p2p-swarm
Commits
22f358a2
Commit
22f358a2
authored
Feb 28, 2019
by
Matt Joiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve dial error messages
parent
a5dfec42
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
swarm_dial.go
swarm_dial.go
+4
-1
No files found.
swarm_dial.go
View file @
22f358a2
...
@@ -290,6 +290,9 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
...
@@ -290,6 +290,9 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
that we previously had (halting a dial when we run out of addrs)
that we previously had (halting a dial when we run out of addrs)
*/
*/
goodAddrs
:=
s
.
filterKnownUndialables
(
s
.
peers
.
Addrs
(
p
))
goodAddrs
:=
s
.
filterKnownUndialables
(
s
.
peers
.
Addrs
(
p
))
if
len
(
goodAddrs
)
==
0
{
return
nil
,
errors
.
New
(
"no good addresses"
)
}
goodAddrsChan
:=
make
(
chan
ma
.
Multiaddr
,
len
(
goodAddrs
))
goodAddrsChan
:=
make
(
chan
ma
.
Multiaddr
,
len
(
goodAddrs
))
for
_
,
a
:=
range
goodAddrs
{
for
_
,
a
:=
range
goodAddrs
{
goodAddrsChan
<-
a
goodAddrsChan
<-
a
...
@@ -352,7 +355,7 @@ func (s *Swarm) dialAddrs(ctx context.Context, p peer.ID, remoteAddrs <-chan ma.
...
@@ -352,7 +355,7 @@ func (s *Swarm) dialAddrs(ctx context.Context, p peer.ID, remoteAddrs <-chan ma.
// use a single response type instead of errs and conns, reduces complexity *a ton*
// use a single response type instead of errs and conns, reduces complexity *a ton*
respch
:=
make
(
chan
dialResult
)
respch
:=
make
(
chan
dialResult
)
defaultDialFail
:=
fm
t
.
Err
orf
(
"failed to dial %s (default failure)"
,
p
)
defaultDialFail
:=
ine
t
.
Err
NoRemoteAddrs
exitErr
:=
defaultDialFail
exitErr
:=
defaultDialFail
defer
s
.
limiter
.
clearAllPeerDials
(
p
)
defer
s
.
limiter
.
clearAllPeerDials
(
p
)
...
...
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