Commit b490cf01 authored by Senthil Kumaran's avatar Senthil Kumaran

Fix closes issue1067702 The problem with close multiple ftp transfers were...

Fix closes issue1067702  The problem with close multiple ftp transfers were due cases where sockets/file were not closed immediately. Tightned those cases and failure is no longer observed.
parent b8cb82d4
...@@ -351,6 +351,7 @@ class FTP: ...@@ -351,6 +351,7 @@ class FTP:
conn, sockaddr = sock.accept() conn, sockaddr = sock.accept()
if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT: if self.timeout is not _GLOBAL_DEFAULT_TIMEOUT:
conn.settimeout(self.timeout) conn.settimeout(self.timeout)
sock.close()
if resp[:3] == '150': if resp[:3] == '150':
# this is conditional in case we received a 125 # this is conditional in case we received a 125
size = parse150(resp) size = parse150(resp)
...@@ -575,11 +576,11 @@ class FTP: ...@@ -575,11 +576,11 @@ class FTP:
def close(self): def close(self):
'''Close the connection without assuming anything about it.''' '''Close the connection without assuming anything about it.'''
if self.file: if self.file is not None:
self.file.close() self.file.close()
if self.sock is not None:
self.sock.close() self.sock.close()
self.file = self.sock = None self.file = self.sock = None
try: try:
import ssl import ssl
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment