summaryrefslogtreecommitdiff
path: root/internal/clients/baseclient.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2021-10-29 08:16:03 +0300
committerPaul Buetow <paul@buetow.org>2021-10-29 08:16:03 +0300
commitda05e08ad5ef57a29609397d81327c92ce848652 (patch)
treec21acd111e5bd012ff0aaa7c91f6e9d688ee9ad9 /internal/clients/baseclient.go
parentd556c13d430f291b615d538c35ebdaf9b53aa15d (diff)
parentdadbaab24d66685db0a2a6655bd75cdbb19eb929 (diff)
merge
Diffstat (limited to 'internal/clients/baseclient.go')
-rw-r--r--internal/clients/baseclient.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/clients/baseclient.go b/internal/clients/baseclient.go
index 4a7bd84..3cd85fe 100644
--- a/internal/clients/baseclient.go
+++ b/internal/clients/baseclient.go
@@ -56,7 +56,7 @@ func (c *baseClient) init() {
}
c.sshAuthMethods, c.hostKeyCallback = client.InitSSHAuthMethods(
c.Args.SSHAuthMethods, c.Args.SSHHostKeyCallback, c.Args.TrustAllHosts,
- c.throttleCh, c.Args.PrivateKeyPathFile)
+ c.throttleCh, c.Args.SSHPrivateKeyPathFile)
}
func (c *baseClient) makeConnections(maker maker) {
@@ -112,10 +112,19 @@ func (c *baseClient) startConnection(ctx context.Context, i int,
// Retrieve status code from handler (dtail client will exit with that status)
status = conn.Handler().Status()
+ // Do we want to retry?
if !c.retry {
+ // No, we don't.
return
}
+ select {
+ case <-ctx.Done():
+ // No, context is done, so no retry.
+ return
+ default:
+ }
+ // Yes, we want to retry.
time.Sleep(time.Second * 2)
dlog.Client.Debug(conn.Server(), "Reconnecting")
conn = c.makeConnection(conn.Server(), c.sshAuthMethods, c.hostKeyCallback)