[Twisted-Python] how to stop dataReceived while waiting a deferred to fire?

James Y Knight foom at fuhm.net
Sun Feb 20 22:08:43 MST 2005


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.

James





More information about the Twisted-Python mailing list