[Twisted-Python] stop receiving from socket until processing finish
Hi! 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 producer. A simple solution is to make processor ask for data to process every time, but when processor is fast enough it will hurt the performance to much. Rodrigo
On Wed, 8 Aug 2007 11:06:24 -0300, Rodrigo Strauss
Hi!
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 producer.
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. Jean-Paul
participants (2)
-
Jean-Paul Calderone
-
Rodrigo Strauss