1
0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-09-18 13:31:36 +02:00

client: Close connection on error

This commit is contained in:
adnano 2021-03-20 12:49:27 -04:00
parent ca2680a958
commit 03767f7a68

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
}
}