mar10 / pyftpsync

Synchronize directories using FTP(S), SFTP, or file system access.
https://pyftpsync.readthedocs.io
MIT License
117 stars 25 forks source link

FTP socket connection not closed after calling close() method. #15

Closed averges closed 7 years ago

averges commented 7 years ago

Running a script like that socket connection remains opened after calling close() method:

try:
     path = '/invalid/path'
     remote = FtpTarget(path, host, port, username, password, tls, timeout)
     remote.open()
except RuntimeError as e:
     remote.close()  

Connected flag is set after change directory is done so if anything goes wrong between connecting to the ftp server and changing directory to root_dir, ftp socket remains opened even when calling close() method.

mar10 commented 7 years ago

Thanks for contributing