Return io.EOF on websocket connection closure
This commit is contained in:
parent
cfb1de044e
commit
0fa07f5f9a
6
conn.go
6
conn.go
@ -3,6 +3,7 @@ package soju
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"sync"
|
||||
"time"
|
||||
@ -47,8 +48,13 @@ func (wic websocketIRCConn) ReadMessage() (*irc.Message, error) {
|
||||
}
|
||||
_, b, err := wic.conn.Read(ctx)
|
||||
if err != nil {
|
||||
switch websocket.CloseStatus(err) {
|
||||
case websocket.StatusNormalClosure, websocket.StatusGoingAway:
|
||||
return nil, io.EOF
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return irc.ParseMessage(string(b))
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user