[Twisted-Python] does setTcpNoDelay() not work?
radix at twistedmatrix.com
Mon Aug 11 14:31:03 EDT 2008
On Mon, Aug 11, 2008 at 2:18 PM, Gabriel Rossetti
<gabriel.rossetti at arimaz.com> wrote:
> Jean-Paul Calderone wrote:
>> Since you didn't include the definition of `sendMessage´, it's hard to say
>> what's really going on here. However, my guess is that you're calling the
>> transport.write method in a non-reactor thread, which is not allowed.
>> If this isn't the case, including a full, minimal example in your next
>> message would be a good idea. :)
> Yes, self.sendMessage() calls transport.write. So there's no way of sending
> msgs from a non-reactor thread, even if it has a reference to the protocol?
use reactor.callFromThread, which takes as an argument a function to
call in the reactor thread. That function can use Twisted APIs like
transport.write. Most Twisted APIs are not thread-safe, and cannot be
called from a non-reactor thread.
International Man of Twistery
More information about the Twisted-Python