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"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
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
|
// all future reads will return an error. A zero value for t means reads will
|
||||||
// not time out.
|
// not time out.
|
||||||
func (c *Conn) SetReadDeadline(t time.Time) error {
|
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)
|
return c.conn.SetReadDeadline(t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue