Commit 5d9d431e authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #38 from libp2p/fix/libp2p/go-libp2p-kad-dht/96

don't backoff dialing when the context is canceled
parents 72ef23a7 37045022
......@@ -203,8 +203,10 @@ func (s *Swarm) doDial(ctx context.Context, p peer.ID) (*Conn, error) {
cancel()
log.Debugf("dial end %s", conn)
if err != nil {
log.Event(ctx, "swarmDialBackoffAdd", logdial)
s.backf.AddBackoff(p) // let others know to backoff
if err != context.Canceled {
log.Event(ctx, "swarmDialBackoffAdd", logdial)
s.backf.AddBackoff(p) // let others know to backoff
}
// ok, we failed. try again. (if loop is done, our error is output)
return nil, fmt.Errorf("dial attempt failed: %s", err)
......
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