[Twisted-Python] Reactor questions

Itamar Shtull-Trauring itamar at itamarst.org
Thu Apr 3 10:18:52 EST 2003


On Thu, 3 Apr 2003 00:54:25 -0800 (PST)
Jasper Phillips <jasper at peak.org> wrote:

> I notice from expirmentation that reactor.stop() seems to sever any
> ongoing network connections.  Is there a way to temporarily stop then
> restart the reactor without losing a network connection?  Or would I
> need to write my own reactor?
> 
> I'm writing unit tests, where I want to script a sequence of events.
> Currently I have a (pyui) loop calling
> twisted.internet.main.iterate(), and have my code accept a startup
> flag telling it whether to stop for procederal

1. Never ever use twisted.internet.main. Please. It is waaaay
deprecated.

2. You can use reactor.iterate().

3. For unittesting, reactor.crash() does exactly what you want - stop
reactor without closing anything.

-- 
Itamar Shtull-Trauring    http://itamarst.org/
http://www.zoteca.com -- Python & Twisted consulting




More information about the Twisted-Python mailing list