Commit fef42503 authored by Steven Allen's avatar Steven Allen

don't leak connections when canceling dials

parent 09cb6bb5
...@@ -166,5 +166,8 @@ func (dl *dialLimiter) executeDial(j *dialJob) { ...@@ -166,5 +166,8 @@ func (dl *dialLimiter) executeDial(j *dialJob) {
select { select {
case j.resp <- dialResult{Conn: con, Addr: j.addr, Err: err}: case j.resp <- dialResult{Conn: con, Addr: j.addr, Err: err}:
case <-j.ctx.Done(): 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