revert back to IsUnexpectedCloseError check

Kubernetes-commit: 914210ee9a6df6927019f200e90534edd1460fea
This commit is contained in:
Arda Güçlü 2023-10-05 12:04:06 +03:00 committed by Kubernetes Publisher
parent e95d92dbc6
commit 9a88950e38

View File

@ -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.
}
}
}