[Twisted-Python] Question on push/pull producers inter-workings, was : "Is there a simple Producer/Consumer example or tutorial?"
mailing_lists at evotex.ch
Fri Apr 18 03:57:35 EDT 2008
I am re-posting these questions with a different title, since they have
ventured away from the original question
I have a question though, I was looking at the way all this works by
using a debugger, and I noticed that in twisted.internet.abstract.py in
registerProducer() there is the following :
if not streaming:
Why is this done only for the pull producer? Shouldn't it also be called
for the push producer since to have the data sent one has to call either
self.transport.write() or resumeProducing() anyways? If you look at :
it does :
thus starting the writing process and in the pull producer :
it doesn't need to start the writing process explicitly since it's
started when the producer is registered.
Oh, and also, since from what I see in the code the only difference with
a push and pull producer is that the push producer is paused if the data
being written/sent is very large (to let the reactor breath and process
other things), if it isn't larger than the buffer it behaves like a pull
producer, correct? If so, then why have both? Am I mixed up again?
More information about the Twisted-Python