diff --git a/trash.lock b/trash.lock index 56d35e3c87..21dc5eb088 100755 --- a/trash.lock +++ b/trash.lock @@ -225,12 +225,11 @@ import: - package: github.com/prometheus/procfs version: 65c1f6f8f0fc1e2185eb9863a3bc751496404259 - package: github.com/rancher/dynamiclistener - version: 03208cf106d553d58d3a73267aa473a45af63120 - repo: https://github.com/erikwilson/rancher-dynamiclistener.git + version: 4716ac2362986f28bede3f3caf5d1ce347da55b0 - package: github.com/rancher/helm-controller version: d5f5c830231110722f14d446d3b2038e5cdf1532 - package: github.com/rancher/remotedialer - version: 20ec38853712bb6d348f0db9ac47d34c954c6b00 + version: 66218bc42b4fa27c34523c0d19a41a0e2b74983d - package: github.com/rancher/wrangler version: d53925110e19e055d1c21df3b49021833e883f33 - package: github.com/rancher/wrangler-api diff --git a/vendor.conf b/vendor.conf index 847b56436e..aa995f0200 100644 --- a/vendor.conf +++ b/vendor.conf @@ -10,12 +10,11 @@ package=github.com/opencontainers/runc/libcontainer/specconv package=github.com/opencontainers/runc/contrib/cmd/recvtty k8s.io/kubernetes v1.14.3-k3s.2 https://github.com/rancher/k3s.git transitive=true,staging=true -github.com/rancher/dynamiclistener 03208cf106d553d58d3a73267aa473a45af63120 https://github.com/erikwilson/rancher-dynamiclistener.git github.com/rancher/wrangler d53925110e19e055d1c21df3b49021833e883f33 github.com/rancher/wrangler-api efe26ac6a9d720e1bfa5a8cc5f8dce5ad598ce26 -github.com/rancher/dynamiclistener 077eb13a904f2c62496f31b158135d9743526f82 -github.com/rancher/remotedialer 20ec38853712bb6d348f0db9ac47d34c954c6b00 +github.com/rancher/dynamiclistener 4716ac2362986f28bede3f3caf5d1ce347da55b0 +github.com/rancher/remotedialer 66218bc42b4fa27c34523c0d19a41a0e2b74983d github.com/rancher/helm-controller d5f5c830231110722f14d446d3b2038e5cdf1532 github.com/matryer/moq ee5226d43009 https://github.com/rancher/moq.git github.com/coreos/flannel 823afe66b2266bf71f5bec24e6e28b26d70cfc7c https://github.com/ibuildthecloud/flannel.git diff --git a/vendor/github.com/rancher/remotedialer/client.go b/vendor/github.com/rancher/remotedialer/client.go index 86dacd110b..48eefc9d7d 100644 --- a/vendor/github.com/rancher/remotedialer/client.go +++ b/vendor/github.com/rancher/remotedialer/client.go @@ -11,14 +11,14 @@ import ( type ConnectAuthorizer func(proto, address string) bool -func ClientConnect(wsURL string, headers http.Header, dialer *websocket.Dialer, auth ConnectAuthorizer, onConnect func(context.Context) error) { - if err := connectToProxy(wsURL, headers, auth, dialer, onConnect); err != nil { - logrus.WithError(err).Error("Failed to connect to proxy") +func ClientConnect(ctx context.Context, wsURL string, headers http.Header, dialer *websocket.Dialer, auth ConnectAuthorizer, onConnect func(context.Context) error) { + if err := connectToProxy(ctx, wsURL, headers, auth, dialer, onConnect); err != nil { + logrus.WithError(err).Error("Remotedialer proxy error") time.Sleep(time.Duration(5) * time.Second) } } -func connectToProxy(proxyURL string, headers http.Header, auth ConnectAuthorizer, dialer *websocket.Dialer, onConnect func(context.Context) error) error { +func connectToProxy(ctx context.Context, proxyURL string, headers http.Header, auth ConnectAuthorizer, dialer *websocket.Dialer, onConnect func(context.Context) error) error { logrus.WithField("url", proxyURL).Info("Connecting to proxy") if dialer == nil { @@ -41,7 +41,18 @@ func connectToProxy(proxyURL string, headers http.Header, auth ConnectAuthorizer } session := NewClientSession(auth, ws) - _, err = session.Serve() - session.Close() - return err + defer session.Close() + + result := make(chan error, 1) + go func() { + _, err = session.Serve() + result <- err + }() + + select { + case <-ctx.Done(): + return ctx.Err() + case err := <-result: + return err + } }