From 914210ee9a6df6927019f200e90534edd1460fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arda=20G=C3=BC=C3=A7l=C3=BC?= Date: Thu, 5 Oct 2023 12:04:06 +0300 Subject: [PATCH] revert back to IsUnexpectedCloseError check --- .../client-go/tools/remotecommand/websocket.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/staging/src/k8s.io/client-go/tools/remotecommand/websocket.go b/staging/src/k8s.io/client-go/tools/remotecommand/websocket.go index 78de8af1aac..4d9814a81f0 100644 --- a/staging/src/k8s.io/client-go/tools/remotecommand/websocket.go +++ b/staging/src/k8s.io/client-go/tools/remotecommand/websocket.go @@ -18,10 +18,8 @@ package remotecommand import ( "context" - "errors" "fmt" "io" - "net" "net/http" "sync" "time" @@ -478,15 +476,12 @@ func (h *heartbeat) start() { klog.V(8).Infof("Websocket Ping succeeeded") } else { klog.Errorf("Websocket Ping failed: %v", err) - if errors.Is(err, gwebsocket.ErrCloseSent) { - continue - } else if e, ok := err.(net.Error); ok && e.Temporary() { - // Continue, in case this is a transient failure. - // c.conn.CloseChan above will tell us when the connection is - // actually closed. - continue + if gwebsocket.IsUnexpectedCloseError(err, gwebsocket.CloseGoingAway, gwebsocket.CloseAbnormalClosure) { + return } - return + // Continue, in case this is a transient failure. + // c.conn.CloseChan above will tell us when the connection is + // actually closed. } } }