[Twisted-Python] how to stop dataReceived while waiting a deferred to fire?
Andrea Arcangeli
andrea at cpushare.com
Mon Feb 21 10:33:32 EST 2005
On Mon, Feb 21, 2005 at 12:08:43AM -0500, James Y Knight wrote:
>
> On Feb 20, 2005, at 11:50 PM, Andrea Arcangeli wrote:
>
> >There must be a way to throttle the input at the kernel level, the recv
> >syscall must not be called while the deferred is outstanding.
> >
> >Please help thanks, I'm stuck on this right now...
>
>
> I assume you're using NetstringReceiver? You want to implement the
> Producer interface: pauseProducing/resumeProducing/stopProducing,
> similar to how LineReceiver implements it. (That is, submit a patch to
> NetstringReceiver implementing it). LineReceiver's pauseProducing does
> exactly what you want: 1) stops the socket from being read more and 2)
> doesn't call lineReceived any more even if there are more lines already
> buffered.
I didn't know about this linereceiver feature, very nice. I'm using
int32stringreceiver which misses it like netstringreceiver (I was
definitely sure something was missing in twisted after reading all the
code of int32stringreceiver), so I'll try to implement it following the
linereceiver example.
Many thanks to get me on the right track!
More information about the Twisted-Python
mailing list