[Twisted-Python] twisted socksv4 proxy

Andrew Bennetts andrew-twisted at puzzling.org
Tue Sep 23 23:45:40 MDT 2003


On Wed, Sep 24, 2003 at 01:16:06AM -0400, Yun Mao wrote:
> Is it true that the only way to see the success of write() is to check the 
> FileDescriptor.dataBuffer? 

There's another way -- if a FileDescriptor is consumer of a producer, it
will call the producer's pauseProducing when its buffer grows too large
(look at the abstract.FileDescriptor.write source).

> I'm thinking that suppose there is one way to check this, and I can
> somehow add a callback function to the success of each write(), then I can
> simply call source.stopReading() after write() and startReading() when I
> get callback.

You really don't want to do this manually -- you're just going to reinvent
Twisted's producers/consumers infrastructure.  See my other reply.

-Andrew.





More information about the Twisted-Python mailing list