From f6bcd5be51a427747be8058d7a7b9887bc2670ca Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 27 Oct 2021 10:07:29 +0300 Subject: Fix --shutdownAfter client switch --- internal/clients/baseclient.go | 9 +++++++++ internal/io/fs/readfile.go | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) 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(): -- cgit v1.2.3