Return io.EOF on websocket connection closure
git-svn-id: file:///srv/svn/repo/suika/trunk@341 f0ae65fe-ee39-954e-97ec-027ff2717ef4
This commit is contained in:
parent
a23ecb0998
commit
8bf8de560b
8
conn.go
8
conn.go
@ -3,6 +3,7 @@ package soju
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"sync"
|
||||
"time"
|
||||
@ -47,7 +48,12 @@ func (wic websocketIRCConn) ReadMessage() (*irc.Message, error) {
|
||||
}
|
||||
_, b, err := wic.conn.Read(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
switch websocket.CloseStatus(err) {
|
||||
case websocket.StatusNormalClosure, websocket.StatusGoingAway:
|
||||
return nil, io.EOF
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return irc.ParseMessage(string(b))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user