Skip to content

Commit b6a045f

Browse files
Merge pull request #6 from libp2p/feat/better-dial-logs
log addr with failures
2 parents 2d61be9 + b4dc58a commit b6a045f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

p2p/net/swarm/limiter.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
type dialResult struct {
1414
Conn iconn.Conn
15+
Addr ma.Multiaddr
1516
Err error
1617
}
1718

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

142143
con, err := dl.dialFunc(j.ctx, j.peer, j.addr)
143144
select {
144-
case j.resp <- dialResult{Conn: con, Err: err}:
145+
case j.resp <- dialResult{Conn: con, Addr: j.addr, Err: err}:
145146
case <-j.ctx.Done():
146147
}
147148
}

p2p/net/swarm/swarm_dial.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ func (s *Swarm) dialAddrs(ctx context.Context, p peer.ID, remoteAddrs <-chan ma.
318318
case resp := <-respch:
319319
active--
320320
if resp.Err != nil {
321-
log.Info("got error on dial: ", resp.Err)
321+
log.Info("got error on dial to %s: ", resp.Addr, resp.Err)
322322
// Errors are normal, lots of dials will fail
323323
exitErr = resp.Err
324324

0 commit comments

Comments
 (0)