4udak / pyftpdlib

Automatically exported from code.google.com/p/pyftpdlib
Other
1 stars 1 forks source link

Problem with ActiveDTP #217

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm not sure what's going on exactly but python3.3 shows some resource warnings 
about socket objects not properly closed for PORT-related tests 
(test_active_conn_error and test_max_connections).
Also, the code below keeps printing "425" responses:

    def test_active_conn_error(self):
        # we open a socket() but avoid to invoke accept() to
        # reproduce this error condition:
        # http://code.google.com/p/pyftpdlib/source/detail?r=905
        sock = socket.socket()
        sock.bind((HOST, 0))
        port = sock.getsockname()[1]
        self.client.sock.settimeout(.1)
        try:
            resp = self.client.sendport(HOST, port)
        except ftplib.error_temp:
            err = sys.exc_info()[1]
            self.assertEqual(str(err)[:3], '425')
        except (socket.timeout, getattr(ssl, "SSLError", object())):
            pass
        else:
            self.assertNotEqual(str(resp)[:3], '200')
        for x in range(10):
            try:
                self.client.sendcmd('noop')
            except Exception as err:
                print(str(err))

I tried to narrow down the problem and the only thing I figured out for sure is 
that something's wrong with ActiveDTP class which is not able to properly close 
the connecting fd in case the connection attempt fails.
Leaving this open as a reminder.

Original issue reported on code.google.com by g.rodola on 2 Aug 2012 at 2:12