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
e20fb5e3
Unverified
Commit
e20fb5e3
authored
Mar 13, 2019
by
Raúl Kripalani
Committed by
GitHub
Mar 13, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #113 from libp2p/no-addresses-ctx-err
Differentiate no addresses error from no good addresses
parents
03ef66e3
dd701926
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
swarm_dial.go
swarm_dial.go
+6
-2
No files found.
swarm_dial.go
View file @
e20fb5e3
...
@@ -84,7 +84,7 @@ const DefaultPerPeerRateLimit = 8
...
@@ -84,7 +84,7 @@ const DefaultPerPeerRateLimit = 8
// DialBackoff is a type for tracking peer dial backoffs.
// DialBackoff is a type for tracking peer dial backoffs.
//
//
// * It's safe to use it
'
s zero value.
// * It's safe to use its zero value.
// * It's thread-safe.
// * It's thread-safe.
// * It's *not* safe to move this type after using.
// * It's *not* safe to move this type after using.
type
DialBackoff
struct
{
type
DialBackoff
struct
{
...
@@ -289,7 +289,11 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
...
@@ -289,7 +289,11 @@ func (s *Swarm) dial(ctx context.Context, p peer.ID) (*Conn, error) {
the improved rate limiter, while maintaining the outward behaviour
the improved rate limiter, while maintaining the outward behaviour
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
))
peerAddrs
:=
s
.
peers
.
Addrs
(
p
)
if
len
(
peerAddrs
)
==
0
{
return
nil
,
errors
.
New
(
"no addresses"
)
}
goodAddrs
:=
s
.
filterKnownUndialables
(
peerAddrs
)
if
len
(
goodAddrs
)
==
0
{
if
len
(
goodAddrs
)
==
0
{
return
nil
,
errors
.
New
(
"no good addresses"
)
return
nil
,
errors
.
New
(
"no good addresses"
)
}
}
...
...
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