Handle shutdown() better

This commit is contained in:
Andrew Resch 2009-05-20 20:11:57 +00:00
parent 447620f89f
commit 1d006e1368

View File

@ -156,11 +156,14 @@ class Daemon(object):
component.start() component.start()
try: try:
reactor.run() reactor.run()
except KeyboardInterrupt: finally:
self.shutdown() self._shutdown()
@export() @export()
def shutdown(self, *args, **kwargs): def shutdown(self, *args, **kwargs):
reactor.callLater(0, reactor.stop)
def _shutdown(self, *args, **kwargs):
try: try:
os.remove(deluge.configmanager.get_config_dir("deluged.pid")) os.remove(deluge.configmanager.get_config_dir("deluged.pid"))
except Exception, e: except Exception, e: