[Twisted-Python] Restarting a reactor listener
Jean-Paul Calderone
exarkun at divmod.com
Tue Aug 1 11:44:23 MDT 2006
On Tue, 01 Aug 2006 19:27:54 +0200, ian.parker at facilita.co.uk wrote:
>I have created an internet server that is started in a thread from a Python QT GUI.
>
>I can call reactor.stop() and sucessfully get notified of shutdown and the run thread terminates, the TCP/IP listen port is closed.
>
>When I restart it by calling reactor.listenTCP() and reactor.run(installSignalHandlers=0) a second time I find that things don't work correctly. e.g. TCP calls are accepted and my protocol.dataReceived() is called but then calling reactor.callInThread(self.blockingMethod, data) does nothing. Also calling stop() a second time does not stop the running reactor thread or terminate the TCP listener.
>
>I have tried numerous options, and have been careful to avoid any conflicts with the GUI threads. It appears that the reactor is not being restarted correctly after stop() and a second run().
>
>What I need is to stop and re-start the listenTCP. Is there a way to do this?
You need to implement this feature :) It is not expected to work any
currently provided reactor.
More likely, though, you just shouldn't call reactor.stop() until you're
ready to exit completely.
Jean-Paul
More information about the Twisted-Python
mailing list