From 47e398abc3a42b7c8f8db7d129f626adcf8150f0 Mon Sep 17 00:00:00 2001 From: c9s Date: Mon, 17 Apr 2023 16:28:38 +0800 Subject: [PATCH] types: do not return for normal closure --- pkg/types/stream.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/types/stream.go b/pkg/types/stream.go index c1f9a8f76..c53472ac3 100644 --- a/pkg/types/stream.go +++ b/pkg/types/stream.go @@ -203,14 +203,12 @@ func (s *StandardStream) Read(ctx context.Context, conn *websocket.Conn, cancel // if it's a websocket related error case *websocket.CloseError: - if err.Code == websocket.CloseNormalClosure { - return + if err.Code != websocket.CloseNormalClosure { + log.WithError(err).Errorf("websocket error abnormal close: %+v", err) } - log.WithError(err).Errorf("websocket error abnormal close: %+v", err) - _ = conn.Close() - // for unexpected close error, we should re-connect + // for close error, we should re-connect // emit reconnect to start a new connection s.Reconnect() return