[Twisted-Python] using a reactor in a loop
L. Daniel Burr
ldanielburr at mac.com
Thu Mar 1 10:42:18 MST 2007
Hi Tom,
On Thu, 01 Mar 2007 11:21:50 -0600, Tom Brown <brown at esteem.com> wrote:
> Hello,
>
> I am trying to use a reactor in a loop. The application will go through
> the
> loop twice then hang when trying to stop the protocol. Here's my loop:
>
The reactor provides an event loop already, so I am confused as to why
you are trying to run it inside another loop. Based on the code you
have posted here, I can't ascertain what your goal is.
Generally speaking, you'd be better served by using the reactor's
loop instead of your own, and stopping/starting your listeners,
rather than the reactor itself.
Also, stopping the reactor from within a protocol is probably
not ideal. That's sort of like telling your OS to shut down
when you're done saving a file ;)
Hope this helps,
L. Daniel Burr
More information about the Twisted-Python
mailing list