Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

ftp: fix lockup on Close failures when using concurrency limit #3984

Nick Craig-Woodda5cbc194a6f
diff --git a/backend/ftp/ftp.go b/backend/ftp/ftp.go
index a818dd87b..f96e66a65 100644
--- a/backend/ftp/ftp.go
+++ b/backend/ftp/ftp.go
@@ -788,11 +788,13 @@ func (f *ftpReadCloser) Close() error {
case <-timer.C:
// if timer fired assume no error but connection dead
fs.Errorf(f.f, "Timeout when waiting for connection Close")
+ f.f.putFtpConnection(nil, nil)
return nil
}
// if errors while reading or closing, dump the connection
if err != nil || f.err != nil {
_ = f.c.Quit()
+ f.f.putFtpConnection(nil, nil)
} else {
f.f.putFtpConnection(&f.c, nil)
}