mirror of
https://github.com/rclone/rclone.git
synced 2025-01-10 00:08:44 +01:00
ftp: add --ftp-close-timeout flag for use with awkward ftp servers #3984
This commit is contained in:
parent
d9959b0271
commit
df451e1e70
@ -104,6 +104,11 @@ given, rclone will empty the connection pool.
|
|||||||
Set to 0 to keep connections indefinitely.
|
Set to 0 to keep connections indefinitely.
|
||||||
`,
|
`,
|
||||||
Advanced: true,
|
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,
|
Name: config.ConfigEncoding,
|
||||||
Help: config.ConfigEncodingHelp,
|
Help: config.ConfigEncodingHelp,
|
||||||
@ -132,6 +137,7 @@ type Options struct {
|
|||||||
DisableEPSV bool `config:"disable_epsv"`
|
DisableEPSV bool `config:"disable_epsv"`
|
||||||
DisableMLSD bool `config:"disable_mlsd"`
|
DisableMLSD bool `config:"disable_mlsd"`
|
||||||
IdleTimeout fs.Duration `config:"idle_timeout"`
|
IdleTimeout fs.Duration `config:"idle_timeout"`
|
||||||
|
CloseTimeout fs.Duration `config:"close_timeout"`
|
||||||
Enc encoder.MultiEncoder `config:"encoding"`
|
Enc encoder.MultiEncoder `config:"encoding"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -931,8 +937,8 @@ func (f *ftpReadCloser) Close() error {
|
|||||||
go func() {
|
go func() {
|
||||||
errchan <- f.rc.Close()
|
errchan <- f.rc.Close()
|
||||||
}()
|
}()
|
||||||
// Wait for Close for up to 60 seconds
|
// Wait for Close for up to 60 seconds by default
|
||||||
timer := time.NewTimer(60 * time.Second)
|
timer := time.NewTimer(time.Duration(f.f.opt.CloseTimeout))
|
||||||
select {
|
select {
|
||||||
case err = <-errchan:
|
case err = <-errchan:
|
||||||
timer.Stop()
|
timer.Stop()
|
||||||
|
Loading…
Reference in New Issue
Block a user