simplify CloseError testing
This commit is contained in:
@@ -116,7 +116,7 @@ func (rc *RecConn) ReadMessage() (messageType int, message []byte, err error) {
|
|||||||
rc.Close()
|
rc.Close()
|
||||||
return messageType, message, nil
|
return messageType, message, nil
|
||||||
}
|
}
|
||||||
if websocket.IsUnexpectedCloseError(err, websocket.CloseNormalClosure) {
|
if err != nil {
|
||||||
rc.CloseAndReconnect()
|
rc.CloseAndReconnect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ func (rc *RecConn) WriteMessage(messageType int, data []byte) error {
|
|||||||
rc.Close()
|
rc.Close()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if websocket.IsUnexpectedCloseError(err, websocket.CloseNormalClosure) {
|
if err != nil {
|
||||||
rc.CloseAndReconnect()
|
rc.CloseAndReconnect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ func (rc *RecConn) WriteJSON(v interface{}) error {
|
|||||||
rc.Close()
|
rc.Close()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if websocket.IsUnexpectedCloseError(err, websocket.CloseNormalClosure) {
|
if err != nil {
|
||||||
rc.CloseAndReconnect()
|
rc.CloseAndReconnect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,7 +185,7 @@ func (rc *RecConn) ReadJSON(v interface{}) error {
|
|||||||
rc.Close()
|
rc.Close()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if websocket.IsUnexpectedCloseError(err, websocket.CloseNormalClosure) {
|
if err != nil {
|
||||||
rc.CloseAndReconnect()
|
rc.CloseAndReconnect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user