Unverified Commit c0bf6756 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #62 from libp2p/fix/close-canceled-dial

don't leak connections when canceling dials
parents 09cb6bb5 fef42503
......@@ -166,5 +166,8 @@ func (dl *dialLimiter) executeDial(j *dialJob) {
select {
case j.resp <- dialResult{Conn: con, Addr: j.addr, Err: err}:
case <-j.ctx.Done():
if err == nil {
con.Close()
}
}
}
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