1
0
Fork 0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-05-06 00:26:19 +02:00

client: Close connection on error

This commit is contained in:
Adnan Maolood 2021-03-20 12:49:27 -04:00
parent 5141eaafaa
commit d5af32e121

View File

@ -131,6 +131,9 @@ func (c *Client) Do(ctx context.Context, req *Request) (*Response, error) {
conn.Close()
return nil, ctx.Err()
case r := <-res:
if r.err != nil {
conn.Close()
}
return r.resp, r.err
}
}