[Twisted-Python] [Fwd: Re: [Zope3-dev] Twisted as server]

Itamar Shtull-Trauring twisted at itamarst.org
Tue Feb 12 07:02:16 EST 2002

Glyph Lefkowitz wrote:

> That was quite a bit of text, if I understand properly -- he was saying
> that you ought to be able to do proto.transport.write =
> proto.transport.socket.makefile().write, with some additional buffering
> trickery for optimization?

I think so, yes. Plus some architectural stuff about how they do 
multiple requests per connection (the task stuff.)

Our current transport code would in fact work with threads without any 
changes (i.e. you could do transport.write in a thread), if not for the 
fact that the event loop integration (addWriter, addReader) isn't thread 

Since in threaded mode the Selectable doesn't need to be in the event 
loop anyway, we just need a flush method for sync mode and a "switch 
to/from sync mode" method and we could have writing to transports be 
usable from threads (only one thread at a time, of course.)

Another nice thing is the Buffering stuff, which lets you have a buffer 
that is on disk as well - it would make producers less needed when 
sending large amounts of data. It would also improve performance of 
writing large amounts of data on fast connection, since without 
producers we can write-at-once.


DualModeChannel.DualModeChannel is the sync/async switchable transport.

Also, I'm starting to feel jealous of Zope3's amount of unittests...

More information about the Twisted-Python mailing list