Skip to content

Commit

Permalink
updated examples and added mtx lock to dialer check
Browse files Browse the repository at this point in the history
  • Loading branch information
gehrkefc committed Feb 20, 2025
1 parent c0df5b2 commit 1f878d7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
18 changes: 8 additions & 10 deletions examples/proxyclient/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ var (
certSecretName = "api-extension-ca-name"
certServerName = "api-extension-tls-name"
connectSecret = "api-extension"
ports = []string{"5555:8443"}
fakeImperativeAPIAddr = "0.0.0.0:8888"
ports = []string{"5555:5555"}
fakeImperativeAPIAddr = "0.0.0.0:6666"
)

func init() {
Expand Down Expand Up @@ -183,14 +183,12 @@ func main() {
logrus.Fatal(err)
}

go func() {
logrus.Info("RDP Client Started... Waiting for CTRL+C")
<-sigChan
logrus.Info("Stopping...")
proxyClient.Run(ctx)

cancel()
proxyClient.Stop()
}()
logrus.Info("RDP Client Started... Waiting for CTRL+C")
<-sigChan
logrus.Info("Stopping...")

proxyClient.Run(ctx)
cancel()
proxyClient.Stop()
}
7 changes: 6 additions & 1 deletion proxyclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,12 @@ func (c *ProxyClient) Run(ctx context.Context) {

default:
logrus.Info("RDPClient: Checking if dialer is built...")
if c.dialer != nil {

c.dialerMtx.Lock()
dialer := c.dialer
c.dialerMtx.Unlock()

if dialer != nil {
logrus.Info("RDPClient: Dialer is built. Ready to start.")
break LookForDialer
}
Expand Down

0 comments on commit 1f878d7

Please sign in to comment.