[Twisted-Python] stop receiving from socket until processing finish

Jean-Paul Calderone exarkun at divmod.com
Wed Aug 8 10:25:14 EDT 2007

On Wed, 8 Aug 2007 11:06:24 -0300, Rodrigo Strauss <rodrigo at 1bit.com.br> wrote:
>Consider the following scenario (each component is a twisted app):
>producer --> processor --> destination
>I need to stop receiving producer data until I'm able to process it
>and send to destination. Using sync sockets, the producer send() with
>block if processor isn't recv'ing as fast as it can send. How can I do
>this using twisted? Something like telling reactor to stop receiving
>from a specific socket until I enable it back. When I send something
>to destination, the reactor will come back to scene and recv data from

A protocol can ask its transport to stop giving it data by calling
pauseProducing.  When it is ready for more data, there's resumeProducing.

Pausing is implemented in the transport by not reading from the socket.


More information about the Twisted-Python mailing list