Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Lib/test/test_ftplib.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def handle_close(self):
# (behaviour witnessed with test_data_connection)
if not self.dtp_conn_closed:
self.baseclass.push('226 transfer complete')
self.close()
self.shutdown()
self.dtp_conn_closed = True

def push(self, what):
Expand All @@ -95,6 +95,9 @@ def push(self, what):
def handle_error(self):
default_error_handler()

def shutdown(self):
self.close()


class DummyFTPHandler(asynchat.async_chat):

Expand Down Expand Up @@ -227,7 +230,7 @@ def cmd_type(self, arg):

def cmd_quit(self, arg):
self.push('221 quit ok')
self.close()
self.shutdown()

def cmd_abor(self, arg):
self.push('226 abor ok')
Expand Down Expand Up @@ -314,7 +317,7 @@ def handle_accepted(self, conn, addr):
self.handler_instance = self.handler(conn, encoding=self.encoding)

def handle_connect(self):
self.close()
self.shutdown()
handle_read = handle_connect

def writable(self):
Expand Down Expand Up @@ -426,12 +429,12 @@ def recv(self, buffer_size):
def handle_error(self):
default_error_handler()

def close(self):
def shutdown(self):
if (isinstance(self.socket, ssl.SSLSocket) and
self.socket._sslobj is not None):
self._do_ssl_shutdown()
else:
super(SSLConnection, self).close()
self.close()


class DummyTLS_DTPHandler(SSLConnection, DummyDTPHandler):
Expand Down
Loading