Only log websocket error if not a close message

This commit is contained in:
Tobie Morgan Hitchcock 2017-02-21 00:17:56 +00:00
parent 05501ba79e
commit d9d6cdca6d

View file

@ -23,6 +23,7 @@ import (
"github.com/abcum/surreal/db" "github.com/abcum/surreal/db"
"github.com/abcum/surreal/sql" "github.com/abcum/surreal/sql"
"github.com/abcum/surreal/util/show" "github.com/abcum/surreal/util/show"
"github.com/gorilla/websocket"
) )
func limit(c *fibre.Context, i int64) int64 { func limit(c *fibre.Context, i int64) int64 {
@ -165,6 +166,9 @@ func routes(s *fibre.Fibre) {
for { for {
_, msg, err := c.Socket().Read() _, msg, err := c.Socket().Read()
if err != nil { if err != nil {
if websocket.IsCloseError(err, 1000, 1001, 1005) {
return nil
}
return err return err
} }
if res, err := db.Execute(c, msg, nil); err != nil { if res, err := db.Execute(c, msg, nil); err != nil {