From a069a9a224c6052cfb0d7a11d521b0bcbe296cb7 Mon Sep 17 00:00:00 2001 From: asapozhkov Date: Tue, 5 Dec 2023 13:00:19 +0300 Subject: [PATCH] fix: break an infinite loop on file transfer --- client/xclient.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/xclient.go b/client/xclient.go index fb163da4..ba179e41 100644 --- a/client/xclient.go +++ b/client/xclient.go @@ -1196,6 +1196,8 @@ loop: for { select { case <-ctx.Done(): + err = ctx.Err() + break loop default: if tb != nil { tb.Wait(FileTransferBufferSize) @@ -1257,6 +1259,8 @@ loop: for { select { case <-ctx.Done(): + err = ctx.Err() + break loop default: n, er := r.Read(buf) if n > 0 {