From 806d6236288905c3e664c9fc392fe9b561175209 Mon Sep 17 00:00:00 2001 From: jpts Date: Thu, 22 Jun 2023 23:35:29 +0100 Subject: [PATCH] fix: correctly handle normal ws closure --- cmd/websocket.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/websocket.go b/cmd/websocket.go index 6b63c75..d27c853 100644 --- a/cmd/websocket.go +++ b/cmd/websocket.go @@ -71,14 +71,15 @@ func (d *WebsocketRoundTripper) WsCallback(ws *websocket.Conn) error { }() for err := range errChan { - if e, ok := err.(*websocket.CloseError); ok { - klog.V(4).Infof("Closing websocket connection with error code %d, err: %s", e.Code, err) - } if websocket.IsCloseError(err, websocket.CloseNormalClosure) { return nil } else if errors.Is(err, io.EOF) { + klog.V(4).Info("Closing websocket connection with EOF") return nil } + if e, ok := err.(*websocket.CloseError); ok { + klog.V(4).Infof("Closing websocket connection with error code %d, err: %s", e.Code, err) + } return err } return nil