From 2fb087891b598d78e022bc4f6bb7a7afc81d7c7f Mon Sep 17 00:00:00 2001 From: Maisem Ali Date: Tue, 8 Mar 2022 12:44:23 -0800 Subject: [PATCH] net/socks5: always close client connections after serving Customer reported an issue where the connections were not closing, and would instead just stay open. This commit makes it so that we close out the connection regardless of what error we see. I've verified locally that it fixes the issue, we should add a test for this. Signed-off-by: Maisem Ali --- net/socks5/socks5.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/socks5/socks5.go b/net/socks5/socks5.go index 12331f3fd..a5dfee820 100644 --- a/net/socks5/socks5.go +++ b/net/socks5/socks5.go @@ -112,11 +112,11 @@ func (s *Server) Serve(l net.Listener) error { return err } go func() { + defer c.Close() conn := &Conn{clientConn: c, srv: s} err := conn.Run() if err != nil { s.logf("client connection failed: %v", err) - conn.clientConn.Close() } }() }