diff --git a/backend/ftp/ftp.go b/backend/ftp/ftp.go index 7631209da..58bd8cab6 100644 --- a/backend/ftp/ftp.go +++ b/backend/ftp/ftp.go @@ -190,7 +190,11 @@ func (f *Fs) getFtpConnection() (c *ftp.ServerConn, err error) { if 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