On Dec 16, 2013, at 1:02 PM, Guido van Rossum <[email protected]> wrote:

>> That would work, but why is it that Twisted uses such a complicated
>> ReconnectingClientFactory?
>> http://twistedmatrix.com/trac/browser/tags/releases/twisted-8.2.0/twisted/internet/protocol.py#L198
> 
> You'd have to ask Twisted.

This is widely regarded as a mistake and we are trying to fix it.  Putting this 
into the transport has all kinds of knock-on additional complexity; for 
example, you can connect either using connectTCP(), or connectTCP().connect().  
You get two methods called for every connection drop 
(ClientFactory.clientConnectionLost, Protocol.connectionLost) which are purely 
redundant.

This is another case where pushing more convenience functionality into a 
primitive just means more re-implementation of that convenience functionality 
in different primitive implementations.  All of this reconnecting logic can be 
higher-level, defined in terms of wrappers around protocols, without any 
additional complexity on the part of the caller.

Technically it's not deprecated yet, but that's only because the replacement 
isn't done.  You can see the work (slowly) proceeding here: 
<http://twistedmatrix.com/trac/ticket/4735>.

-glyph

Reply via email to