[Twisted-Python] When do calls to transport.write() block ?

Stefan Behnel behnel_ml at gkec.informatik.tu-darmstadt.de
Tue May 11 12:50:19 EDT 2004


Itamar Shtull-Trauring wrote:
> An iterator, you mean. Hmm, because even a pull producer may not have
> data on hand, you'd need to have a special object which means "I don't
> have data, sorry" that the iterator can return.

That would be "None", I guess. What else could it possibly mean to write None to the transport?

> And you'd still need API
> for push producers.

True. However, the registration methods could easily distinguish producers and iterators. So maybe this could be handled transparent for the API. It would not even break anything if the methods defaulted to using the object as a producer if it has the right methods and only check for iterator capabilities if it does not.

> What we were thinking of doing is getting rid of the concept of
> producers altogether and just exposing "buffers empty and writable" and
> "buffers full" callback events similar to dataReceived or
> connectionLost.

Sounds reasonable to me.

Thanks again for your help,

More information about the Twisted-Python mailing list