diff options
Diffstat (limited to 'vendor/github.com/Rhymen/go-whatsapp/read.go')
-rw-r--r-- | vendor/github.com/Rhymen/go-whatsapp/read.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/vendor/github.com/Rhymen/go-whatsapp/read.go b/vendor/github.com/Rhymen/go-whatsapp/read.go index 42d91ff4..b870f5f8 100644 --- a/vendor/github.com/Rhymen/go-whatsapp/read.go +++ b/vendor/github.com/Rhymen/go-whatsapp/read.go @@ -15,7 +15,10 @@ import ( ) func (wac *Conn) readPump() { - defer wac.wg.Done() + defer func() { + wac.wg.Done() + _, _ = wac.Disconnect() + }() var readErr error var msgType int @@ -31,7 +34,6 @@ func (wac *Conn) readPump() { case <-readerFound: if readErr != nil { wac.handle(&ErrConnectionFailed{Err: readErr}) - _, _ = wac.Disconnect() return } msg, err := ioutil.ReadAll(reader) |