From 2cfdb0a08a10c3d6f056bc4cca29afc7dc8210fd Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Fri, 7 May 2021 10:03:24 +0800 Subject: [PATCH] cloudproxy: agent: wait a while on connect error --- pkg/cloudproxy/agent/ssh/client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/cloudproxy/agent/ssh/client.go b/pkg/cloudproxy/agent/ssh/client.go index 5f19a11036..99c10212e0 100644 --- a/pkg/cloudproxy/agent/ssh/client.go +++ b/pkg/cloudproxy/agent/ssh/client.go @@ -190,6 +190,12 @@ func (c *Client) runClientState(ctx context.Context, sshClientC chan *ssh.Client sshc, err := c.cc.ConnectContext(tmoCtx) if err != nil { log.Errorf("ssh connect: %v", err) + waitTmo := time.NewTimer(13 * time.Second) + select { + case <-ctx.Done(): + return + case <-waitTmo.C: + } continue }