[Twisted-Python] iConnector factory not what expected

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Thu Jun 14 20:40:36 EDT 2012


On 14 Jun, 03:34 pm, martin at webscio.net wrote:
>Hi again,
>
>I've a bit of code that does the following:
>
>f = MyReconnectingClientFactory()
>iConn = reactor.connectSSL(url, port, f, ssl.ClientContextFactory())
>
>now I would expect that iConn.factory would be my f, but as it turns 
>out
>it's an instance of some TLSMemoryBIOFactory.. Why is that so?
>
>After some digging, I was able to find f under
>iConn.transport.protocol.wrappedProtocol.factory.. I'm happy to use
>that, but it just sounds a bit weird to me.. or is this normal?

There is no "factory" attribute on the `IConnector` interface at all:

http://twistedmatrix.com/documents/current/api/twisted.internet.interfaces.IConnector.html

Neither is there a "transport" attribute, nor do any of the transport 
interfaces have a "protocol" attribute.

All this means that Twisted isn't promising you anything about the 
meaning or existence of any of these attributes.

So, why don't you just use `f` instead?

Jean-Paul



More information about the Twisted-Python mailing list