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: add --ftp-close-timeout flag for use with awkward ftp servers #3984

Nick Craig-Wooddf451e1e702a
diff --git a/backend/ftp/ftp.go b/backend/ftp/ftp.go
index b7c7650ce..148e04f0b 100644
--- a/backend/ftp/ftp.go
+++ b/backend/ftp/ftp.go
@@ -104,6 +104,11 @@ given, rclone will empty the connection pool.
Set to 0 to keep connections indefinitely.
`,
Advanced: true,
+ }, {
+ Name: "close_timeout",
+ Help: "Maximum time to wait for a response to close.",
+ Default: fs.Duration(60 * time.Second),
+ Advanced: true,
}, {
Name: config.ConfigEncoding,
Help: config.ConfigEncodingHelp,
@@ -132,6 +137,7 @@ type Options struct {
DisableEPSV bool `config:"disable_epsv"`
DisableMLSD bool `config:"disable_mlsd"`
IdleTimeout fs.Duration `config:"idle_timeout"`
+ CloseTimeout fs.Duration `config:"close_timeout"`
Enc encoder.MultiEncoder `config:"encoding"`
}
@@ -931,8 +937,8 @@ func (f *ftpReadCloser) Close() error {
go func() {
errchan <- f.rc.Close()
}()
- // Wait for Close for up to 60 seconds
- timer := time.NewTimer(60 * time.Second)
+ // Wait for Close for up to 60 seconds by default
+ timer := time.NewTimer(time.Duration(f.f.opt.CloseTimeout))
select {
case err = <-errchan:
timer.Stop()