recover from timeout error

This commit is contained in:
Ikhtiyor Ahmedov 2017-06-02 15:05:04 +05:00
parent a91eba7f97
commit 0d7be512eb
1 changed files with 7 additions and 1 deletions

View File

@ -958,7 +958,13 @@ func (c *Conn) NextReader() (messageType int, r io.Reader, err error) {
panic("repeated read on failed websocket connection")
}
return noFrame, nil, c.readErr
err = c.readErr
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
c.readErr = nil
c.readErrCount--
}
return noFrame, nil, err
}
type messageReader struct{ c *Conn }