🐛 fix #462 check connect while get ftp client

pull/548/head
微凉 2022-01-31 11:13:29 +08:00
parent 6fd05d7d72
commit cb23edc1fe
1 changed files with 6 additions and 1 deletions

View File

@ -11,7 +11,12 @@ var connMap map[string]*ftp.ServerConn
func (driver FTP) Login(account *model.Account) (*ftp.ServerConn, error) {
conn, ok := connMap[account.Name]
if ok {
return conn, nil
_, err := conn.CurrentDir()
if err == nil {
return conn, nil
} else {
delete(connMap, account.Name)
}
}
conn, err := ftp.Connect(account.SiteUrl)
if err != nil {