In FTPServer.close_all() sort the list of asyncore.socket_map instances so that FTPHandler and derived subclasses are closed first. Rationale:
In FTPServer.close_all() sort the list of asyncore.socket_map instances so that FTPHandler and derived subclasses are closed first.
Rationale:

        # We sort the list so that we close all FTPHandler instances
        # first since FTPHandler.close() has the peculiarity of
        # automatically closing all its children (DTPHandler, ActiveDTP
        # and PassiveDTP).
        # This should minimize the possibility to incur in race
        # conditions or memory leaks caused by orphaned references
        # left behind in case of error.





giampaolo/pyftpdlib