[Twisted-Python] ProducerConsumerProxy problem
![](https://secure.gravatar.com/avatar/f0b156272eb87b9dd8fe75d685992c55.jpg?s=120&d=mm&r=g)
Hi, I'm trying to setup a ProducerConsumerProxy between a protocols.basic.FileSender producer and a TCP Protocol transport. I have the following code: fileObj = file('test.txt','r') proxy = protocols.pcp.ProducerConsumerProxy(self.transport) producer = protocols.basic.FileSender() dd = producer.beginFileTransfer(fileObj, proxy) dd.addCallback(self.uploadDone) dd.addErrback(self.uploadError) proxy.registerProducer(producer, False) The problem is that only 16KB of data are transfered and then the transfer pauses. Also if I use BasicProducerConsumerProxy no data at all gets transfered. I think that the proxy doesn't call resumeProducing() on the FileSender producer and thats why the transfer seems to halt. Any suggestions ?
![](https://secure.gravatar.com/avatar/f0b156272eb87b9dd8fe75d685992c55.jpg?s=120&d=mm&r=g)
I found the solution. The problem was that by default our proxys producer is registered with streaming = True which is not what we want. The following line will register our proxys producer with streaming = False ProducerConsumerProxy.iAmStreaming = False The rest is the same. I think adding an argument to ProducerConsumerProxy.__init__ about streaming would be a good idea. proxy = ProducerConsumerProxy(self.client.transport) dd = FileSender().beginFileTransfer(self.outgoingFile, proxy) dd.addCallback(self.uploadDone) dd.addErrback(self.uploadError)
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On Sun, 2006-04-30 at 19:24 +0300, Haris Andrianakis wrote:
Add the patch to our issue tracker? -- Itamar Shtull-Trauring http://itamarst.org
![](https://secure.gravatar.com/avatar/f0b156272eb87b9dd8fe75d685992c55.jpg?s=120&d=mm&r=g)
I found the solution. The problem was that by default our proxys producer is registered with streaming = True which is not what we want. The following line will register our proxys producer with streaming = False ProducerConsumerProxy.iAmStreaming = False The rest is the same. I think adding an argument to ProducerConsumerProxy.__init__ about streaming would be a good idea. proxy = ProducerConsumerProxy(self.client.transport) dd = FileSender().beginFileTransfer(self.outgoingFile, proxy) dd.addCallback(self.uploadDone) dd.addErrback(self.uploadError)
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On Sun, 2006-04-30 at 19:24 +0300, Haris Andrianakis wrote:
Add the patch to our issue tracker? -- Itamar Shtull-Trauring http://itamarst.org
participants (2)
-
Haris Andrianakis
-
Itamar Shtull-Trauring