From bee2001e292859ad5e49428a57acdb3c2ff1a91a Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 4 Jun 2020 12:18:51 +0200 Subject: [PATCH] Close net.Conn in conn.Close Close the connection in conn.Close. This ensures the connection isn't still alive after conn.Close, which would cause issues when disconnecting and reconnecting quickly to an upstream server. --- conn.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conn.go b/conn.go index f13038d..ab72d12 100644 --- a/conn.go +++ b/conn.go @@ -84,9 +84,10 @@ func (c *conn) Close() error { return fmt.Errorf("connection already closed") } + err := c.net.Close() c.closed = true close(c.outgoing) - return nil + return err } func (c *conn) ReadMessage() (*irc.Message, error) {