Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #113 from libp2p/no-addresses-ctx-err
Browse files Browse the repository at this point in the history
Differentiate no addresses error from no good addresses
  • Loading branch information
raulk committed Mar 13, 2019
2 parents 03ef66e + dd70192 commit e20fb5e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions swarm_dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const DefaultPerPeerRateLimit = 8

// 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 *not* safe to move this type after using.
type DialBackoff struct {
Expand Down Expand Up @@ -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
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 {
return nil, errors.New("no good addresses")
}
Expand Down

0 comments on commit e20fb5e

Please sign in to comment.