From 2c70332493367acb4b268bae3714ad84f8b53cba Mon Sep 17 00:00:00 2001 From: Nick Cabatoff Date: Tue, 29 Oct 2019 16:57:37 -0400 Subject: [PATCH] Prevent negative waitgroup panic by `Add`ing first. --- conn.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conn.go b/conn.go index ab9bd4f9..a14d8943 100644 --- a/conn.go +++ b/conn.go @@ -191,9 +191,9 @@ func NewConn(conn net.Conn, isTLS bool) *Conn { // Start initializes goroutines to read responses and process messages func (l *Conn) Start() { + l.wgClose.Add(1) go l.reader() go l.processMessages() - l.wgClose.Add(1) } // IsClosing returns whether or not we're currently closing.