[Twisted-Python] t.test.proto_helpers.StringTransportWithDisconnection.connectionLost

Adi Roiban adi at roiban.ro
Wed May 22 01:01:32 MDT 2013


Hi,



In proto_helpers, StringTransportWithDisconnection is implemented as:

class StringTransportWithDisconnection(StringTransport):
    def loseConnection(self):
        if self.connected:
            self.connected = False
            self.protocol.connectionLost(error.ConnectionDone("Bye."))


In the API, I see that for IProtocol.connectionLost(reason), readon
should be a Failure and not an Exception.

http://twistedmatrix.com/documents/13.0.0/api/twisted.internet.interfaces.IProtocol.html#connectionLost

------

Also checking some real code in protocols.ftp shows that reason should
be a Failure, as it uses reason.check() method.

https://github.com/twisted/twisted/blob/trunk/twisted/protocols/ftp.py#L2269

------


Is this a bug in the current implementation of
StringTransportWithDisconnection?

Many thanks,
-- 
Adi Roiban



More information about the Twisted-Python mailing list