Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Close the client connection after a read error
The existing code doesn't `defer c.con.Close()` and exits early if reading encounters any error -- so `.Close()` is never called on the connection. This change stores any read and closing errors, `Join`ing them on return, ensuring that `.Close()` is always called. I'm not 100% sure but I hope this will help prevent the half-closed client connections referenced from bluesky-social#21 There is probably a more idiomatic way to do this (i am a go noob) but if i understand `errors.Join` and the current code, I think this should keep pretty close to the current intended behavior for any caller.
- Loading branch information