ftp: fix lockup when using concurrency limit on failed connections #3984
Before this change if rclone failed to make an FTP connection for some reason it would leak a concurrency token. When all the tokens were leaked then rclone would lock up. The fix returns the concurrency token if creating the FTP connection returns an error.
This commit is contained in:
parent
07e4b9bb7f
commit
28f69f25a0
1 changed files with 5 additions and 1 deletions
|
@ -190,7 +190,11 @@ func (f *Fs) getFtpConnection() (c *ftp.ServerConn, err error) {
|
||||||
if c != nil {
|
if c != nil {
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
return f.ftpConnection()
|
c, err = f.ftpConnection()
|
||||||
|
if err != nil && f.opt.Concurrency > 0 {
|
||||||
|
f.tokens.Put()
|
||||||
|
}
|
||||||
|
return c, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return an FTP connection to the pool
|
// Return an FTP connection to the pool
|
||||||
|
|
Loading…
Reference in a new issue