You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

16 lines
488 B

from twisted.internet.error import ReactorNotRunning, AlreadyCancelled
from twisted.internet import reactor
def stop_reactor():
""" The value of the bool `reactor.running`
does not reliably tell us whether the
reactor is running (!). There are startup
and shutdown phases not reported externally
by IReactorCore. So we must catch Exceptions
raised by trying to stop the reactor.
"""
try:
reactor.stop()
except ReactorNotRunning:
pass