[BUGFIX] websocket error handling

This commit is contained in:
Martin Geno 2017-11-17 20:38:53 +01:00
parent 9d60973ea1
commit c2c5666977
No known key found for this signature in database
GPG Key ID: F0D39A37E925E941
1 changed files with 3 additions and 4 deletions

View File

@ -1,8 +1,6 @@
package websocket package websocket
import ( import (
"io"
"github.com/google/uuid" "github.com/google/uuid"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
@ -106,10 +104,11 @@ func (c *Client) listenRead() {
default: default:
var msg Message var msg Message
err := websocket.ReadJSON(c.ws, &msg) err := websocket.ReadJSON(c.ws, &msg)
if err == io.EOF { if websocket.IsCloseError(err, websocket.CloseGoingAway) {
return return
} else if err != nil { } else if err != nil {
log.Println(err, c.GetID()) log.Infof("error on reading %s: %s", c.GetID(), err)
return
} else { } else {
c.handleInput(&msg) c.handleInput(&msg)
} }