summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <pbuetow@mimecast.com>2021-10-27 10:07:29 +0300
committerPaul Buetow <pbuetow@mimecast.com>2021-10-27 10:07:29 +0300
commitf6bcd5be51a427747be8058d7a7b9887bc2670ca (patch)
tree4eb77f9de07e4fa193e35c8105b0d1669924a347 /internal
parentd0492e3f63f86ce053f59362a55d23cf6397d526 (diff)
Fix --shutdownAfter client switch
Diffstat (limited to 'internal')
-rw-r--r--internal/clients/baseclient.go9
-rw-r--r--internal/io/fs/readfile.go1
2 files changed, 9 insertions, 1 deletions
diff --git a/internal/clients/baseclient.go b/internal/clients/baseclient.go
index 41521ea..3cd85fe 100644
--- a/internal/clients/baseclient.go
+++ b/internal/clients/baseclient.go
@@ -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)
diff --git a/internal/io/fs/readfile.go b/internal/io/fs/readfile.go
index 5815aa3..a42fc53 100644
--- a/internal/io/fs/readfile.go
+++ b/internal/io/fs/readfile.go
@@ -233,7 +233,6 @@ func (f readFile) filterWithoutLContext(ctx context.Context, rawLines <-chan *by
return
}
if filteredLine, ok := f.transmittable(line, len(lines), cap(lines), re); ok {
- //dlog.Common.Trace("TODO", "lines", lines, len(lines), cap(lines))
select {
case lines <- filteredLine:
case <-ctx.Done():