[Twisted-Python] Reactor questions

Jasper Phillips jasper at peak.org
Thu Apr 3 19:36:23 EST 2003


On Thu, 3 Apr 2003, Itamar Shtull-Trauring wrote:

> 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.

Yah, I saw a note to that effect in main, but I was following an
example I found, and the results worked so I stuck with it for a bit.

> 2. You can use reactor.iterate().

Much better.

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

Ah, I see it now.  The name threw me off, as "crash" doesn't exactly
sound recoverable. ;-)

Thanks for your help!
-Jasper






More information about the Twisted-Python mailing list