Unverified Commit e20fb5e3 authored by Raúl Kripalani's avatar Raúl Kripalani Committed by GitHub

Merge pull request #113 from libp2p/no-addresses-ctx-err

Differentiate no addresses error from no good addresses
parents 03ef66e3 dd701926
......@@ -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 {
......@@ -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")
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment