From cf116cf3a13f9017e9392bef103ae2b9cecfe8e7 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Mon, 24 Sep 2007 08:22:02 +0000 Subject: [PATCH] Make shutdown() an async method. --- deluge/core/core.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/deluge/core/core.py b/deluge/core/core.py index c6b15dba4..644970296 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -147,10 +147,8 @@ class Core(dbus.service.Object): self.loop = gobject.MainLoop() self.loop.run() - # Exported Methods - @dbus.service.method("org.deluge_torrent.Deluge") - def shutdown(self): - """Shutdown the core""" + def _shutdown(self): + """This is called by a thread from shutdown()""" log.info("Shutting down core..") self.loop.quit() del self.torrents @@ -161,6 +159,14 @@ class Core(dbus.service.Object): del self.config del deluge.configmanager del self.session + + # Exported Methods + @dbus.service.method(dbus_interface="org.deluge_torrent.Deluge", + in_signature="", out_signature="") + def shutdown(self): + """Shutdown the core""" + # Make shutdown an async call + gobject.idle_add(self._shutdown) @dbus.service.method(dbus_interface="org.deluge_torrent.Deluge", in_signature="say", out_signature="b") @@ -338,9 +344,8 @@ class Core(dbus.service.Object): out_signature="d") def get_download_rate(self): """Returns the payload download rate""" - # print self.session.status().payload_download_rate return self.session.status().payload_download_rate -# return 0.0 + @dbus.service.method(dbus_interface="org.deluge_torrent.Deluge", out_signature="d")