Merge pull request #17 from TheoMcGinley/close-channel-after-error

Closed receiver chan on error
This commit is contained in:
Mickaël Rémond 2019-02-09 22:49:38 +01:00 committed by GitHub
commit da4ae4693e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,6 +150,7 @@ func (c *Client) recv(receiver chan<- interface{}) (err error) {
for { for {
val, err := next(c.Session.decoder) val, err := next(c.Session.decoder)
if err != nil { if err != nil {
close(receiver)
return err return err
} }
receiver <- val receiver <- val