client: Close connection on error
This commit is contained in:
parent
5141eaafaa
commit
d5af32e121
@ -131,6 +131,9 @@ func (c *Client) Do(ctx context.Context, req *Request) (*Response, error) {
|
|||||||
conn.Close()
|
conn.Close()
|
||||||
return nil, ctx.Err()
|
return nil, ctx.Err()
|
||||||
case r := <-res:
|
case r := <-res:
|
||||||
|
if r.err != nil {
|
||||||
|
conn.Close()
|
||||||
|
}
|
||||||
return r.resp, r.err
|
return r.resp, r.err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user