[Twisted-Python] Example of re-usable ClientFactories?
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Wed Jun 15 16:37:49 EDT 2011
On 08:24 pm, glyph at twistedmatrix.com wrote:
>On Jun 15, 2011, at 4:08 PM, exarkun at twistedmatrix.com wrote:
>>>However, I should note that with the advent of endpoints,
>>>ClientFactory
>>>is no longer necessary. Connection failure is communicated on an
>>>endpoint via the Deferred from connect() errbacking, so there's no
>>>need
>>>for the extra callbacks that ClientFactory provides.
>>
>>Except clientConnectionLost.
>
>
>I chose my words carefully :-).
>
>clientConnectionLost was always a duplicate of
>IProtocol.connectionLost.
>
>It might be handy to have that notification delivered in multiple
>places (specifically, for implementing ReconnectingClientFactory), but
>it's not necessary (there's no "need" for it) since you can clone it by
>wrapping IProtocol instead of duplicating it in the guts of the
>reactor.
The callback (not errback) case of the client endpoint API is redundant
as well, then, since IProtocol.makeConnection exposes the same
information. :)
Jean-Paul
More information about the Twisted-Python
mailing list