Skip to content

Commit

Permalink
Merge pull request #6 from libp2p/feat/better-dial-logs
Browse files Browse the repository at this point in the history
log addr with failures
  • Loading branch information
whyrusleeping authored Nov 22, 2016
2 parents 2d61be9 + b4dc58a commit b6a045f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion p2p/net/swarm/limiter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

type dialResult struct {
Conn iconn.Conn
Addr ma.Multiaddr
Err error
}

Expand Down Expand Up @@ -141,7 +142,7 @@ func (dl *dialLimiter) executeDial(j *dialJob) {

con, err := dl.dialFunc(j.ctx, j.peer, j.addr)
select {
case j.resp <- dialResult{Conn: con, Err: err}:
case j.resp <- dialResult{Conn: con, Addr: j.addr, Err: err}:
case <-j.ctx.Done():
}
}
2 changes: 1 addition & 1 deletion p2p/net/swarm/swarm_dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func (s *Swarm) dialAddrs(ctx context.Context, p peer.ID, remoteAddrs <-chan ma.
case resp := <-respch:
active--
if resp.Err != nil {
log.Info("got error on dial: ", resp.Err)
log.Info("got error on dial to %s: ", resp.Addr, resp.Err)
// Errors are normal, lots of dials will fail
exitErr = resp.Err

Expand Down

0 comments on commit b6a045f

Please sign in to comment.