Commit 22f358a2 authored by Matt Joiner's avatar Matt Joiner

Improve dial error messages

parent a5dfec42
...@@ -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 := fmt.Errorf("failed to dial %s (default failure)", p) defaultDialFail := inet.ErrNoRemoteAddrs
exitErr := defaultDialFail exitErr := defaultDialFail
defer s.limiter.clearAllPeerDials(p) defer s.limiter.clearAllPeerDials(p)
......
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