mirror of
https://github.com/rancher/norman.git
synced 2025-09-13 13:50:16 +00:00
Configure HandshakeTimeout in websocket.Dialer
To prevent agent from being hung in the middle of Websocket Session Handshake, We'd better to set HandshakeTimeout Related to https://github.com/rancher/rancher/issues/21117
This commit is contained in:
@@ -277,7 +277,7 @@ func NewAPIClient(opts *ClientOpts) (APIBaseClient, error) {
|
|||||||
result.Ops = &APIOperations{
|
result.Ops = &APIOperations{
|
||||||
Opts: opts,
|
Opts: opts,
|
||||||
Client: client,
|
Client: client,
|
||||||
Dialer: &websocket.Dialer{},
|
Dialer: &websocket.Dialer{HandshakeTimeout: 10 * time.Second},
|
||||||
Types: result.Types,
|
Types: result.Types,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ func connectToProxy(proxyURL string, headers http.Header, auth ConnectAuthorizer
|
|||||||
logrus.WithField("url", proxyURL).Info("Connecting to proxy")
|
logrus.WithField("url", proxyURL).Info("Connecting to proxy")
|
||||||
|
|
||||||
if dialer == nil {
|
if dialer == nil {
|
||||||
dialer = &websocket.Dialer{}
|
dialer = &websocket.Dialer{HandshakeTimeout: 10 * time.Second}
|
||||||
}
|
}
|
||||||
ws, _, err := dialer.Dial(proxyURL, headers)
|
ws, _, err := dialer.Dial(proxyURL, headers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -79,6 +79,7 @@ func (p *peer) start(ctx context.Context, s *Server) {
|
|||||||
TLSClientConfig: &tls.Config{
|
TLSClientConfig: &tls.Config{
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
},
|
},
|
||||||
|
HandshakeTimeout: 10 * time.Second,
|
||||||
}
|
}
|
||||||
|
|
||||||
outer:
|
outer:
|
||||||
|
Reference in New Issue
Block a user