Skip to content

Commit

Permalink
added retry timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
gehrkefc committed Jan 28, 2025
1 parent 51b4974 commit 7550820
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions proxyclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"crypto/x509"
"fmt"
"net/http"
"time"

"github.com/gorilla/websocket"
"github.com/rancher/remotedialer"
Expand All @@ -25,6 +26,7 @@ var (
nonTLSDialer = &websocket.Dialer{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
retryTimeout = 1 * time.Second
)

type PortForwarder interface {
Expand Down Expand Up @@ -126,6 +128,8 @@ func (c *ProxyClient) Run(ctx context.Context) {
default:
if err := c.forwarder.Start(); err != nil {
logrus.Errorf("remotedialer.ProxyClient error: %s ", err)
time.Sleep(retryTimeout)
continue
}

logrus.Infof("ProxyClient connecting to %s", c.serverUrl)
Expand All @@ -144,6 +148,7 @@ func (c *ProxyClient) Run(ctx context.Context) {

if err := remotedialer.ClientConnect(ctx, c.serverUrl, headers, c.dialer, onConnectAuth, onConnect); err != nil {
logrus.Errorf("remotedialer.ClientConnect error: %s", err.Error())
time.Sleep(retryTimeout)
}
}
}
Expand Down

0 comments on commit 7550820

Please sign in to comment.