mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 08:45:16 +00:00
Merge pull request #1151 from c9s/fix/websocket-reconnect
FIX: types: do not return for normal closure
This commit is contained in:
commit
5c33c764da
|
@ -203,14 +203,12 @@ func (s *StandardStream) Read(ctx context.Context, conn *websocket.Conn, cancel
|
||||||
|
|
||||||
// if it's a websocket related error
|
// if it's a websocket related error
|
||||||
case *websocket.CloseError:
|
case *websocket.CloseError:
|
||||||
if err.Code == websocket.CloseNormalClosure {
|
if err.Code != websocket.CloseNormalClosure {
|
||||||
return
|
log.WithError(err).Errorf("websocket error abnormal close: %+v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.WithError(err).Errorf("websocket error abnormal close: %+v", err)
|
|
||||||
|
|
||||||
_ = conn.Close()
|
_ = conn.Close()
|
||||||
// for unexpected close error, we should re-connect
|
// for close error, we should re-connect
|
||||||
// emit reconnect to start a new connection
|
// emit reconnect to start a new connection
|
||||||
s.Reconnect()
|
s.Reconnect()
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user