mirror of https://github.com/gorilla/websocket.git
refine SetReadDeadline
This commit is contained in:
parent
c908dc801c
commit
ad3825164f
4
conn.go
4
conn.go
|
@ -16,6 +16,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -1029,6 +1030,9 @@ func (c *Conn) ReadMessage() (messageType int, p []byte, err error) {
|
|||
// all future reads will return an error. A zero value for t means reads will
|
||||
// not time out.
|
||||
func (c *Conn) SetReadDeadline(t time.Time) error {
|
||||
if c.readErr != nil && strings.Contains(c.readErr.Error(), "i/o timeout") {
|
||||
c.readErr = nil
|
||||
}
|
||||
return c.conn.SetReadDeadline(t)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue