txamqp-user team mailing list archive
-
txamqp-user team
-
Mailing list archive
-
Message #00005
Re: Sending from a for loop
Hi
On Tue, Aug 11, 2009 at 10:12 AM, Esteve
Fernandez<esteve.fernandez@xxxxxxxxx> wrote:
> I thought that using callFromThread(self.transport.write, data) would
> solve that problem, but I'm afraid it didn't.
That's weird, I just tried callFromThread again, and everything worked
fine. I think I was using Twisted 2.5.0 when I last tested it, and now
8.2.0, that's the only difference, AFAIK.
Anyway, Dan could you test the attached patch?
Cheers.
=== modified file 'src/txamqp/protocol.py'
--- src/txamqp/protocol.py 2009-07-16 20:06:49 +0000
+++ src/txamqp/protocol.py 2009-08-11 08:20:52 +0000
@@ -1,6 +1,6 @@
# coding: utf-8
from twisted.python import log
-from twisted.internet import defer, protocol
+from twisted.internet import defer, protocol, reactor
from twisted.protocols import basic
from txamqp import spec
from txamqp.codec import Codec, EOF
@@ -110,7 +110,7 @@
# packs a frame and writes it to the underlying transport
def sendFrame(self, frame):
data = self._packFrame(frame)
- self.transport.write(data)
+ reactor.callFromThread(self.transport.write, data)
# packs a frame, see qpid.connection.Connection#write
def _packFrame(self, frame):
Follow ups
References