[Twisted-Python] loseConnection should stop the int32/int16 stringReceived too
exarkun at divmod.com
Mon Mar 14 07:58:47 EST 2005
On Sun, 13 Mar 2005 20:57:09 +0100, Andrea Arcangeli <andrea at cpushare.com> wrote:
>This patch adds a check for transport.disconnecting to the int16/32
> protocols, so that they don't keep firing stringReceived callbacks after
> calling transport.loseConnection (in line with the linereceiver
> protocol). This also adds the methods for pauseproducer in line with the
> linereceiver protocol (as per previous patch in this thread).
> If these two fixes to int32/16 are correct please apply to SVN.
transport.disconnecting is horrible (it's an implementation detail, it doesn't work on a lot of transports). LineReceiver shouldn't be using it. The feature LineReceiver uses it to implement may be reasonable, though, which is why its code is still how it is.
If the feature is desired somewhere else, the best way to add it is to either find another way that doesn't rely on transport.disconnecting (and then we can fix LineReceiver too), or factor the code such that all protocols can provide the feature without having more than one method that relies on transport.disconnecting (then we can fix them all at once someday).
More information about the Twisted-Python