Make shutdown() an async method.

This commit is contained in:
Andrew Resch 2007-09-24 08:22:02 +00:00
parent 67347e67b6
commit cf116cf3a1

View File

@ -147,10 +147,8 @@ class Core(dbus.service.Object):
self.loop = gobject.MainLoop() self.loop = gobject.MainLoop()
self.loop.run() self.loop.run()
# Exported Methods def _shutdown(self):
@dbus.service.method("org.deluge_torrent.Deluge") """This is called by a thread from shutdown()"""
def shutdown(self):
"""Shutdown the core"""
log.info("Shutting down core..") log.info("Shutting down core..")
self.loop.quit() self.loop.quit()
del self.torrents del self.torrents
@ -161,6 +159,14 @@ class Core(dbus.service.Object):
del self.config del self.config
del deluge.configmanager del deluge.configmanager
del self.session 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", @dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
in_signature="say", out_signature="b") in_signature="say", out_signature="b")
@ -338,9 +344,8 @@ class Core(dbus.service.Object):
out_signature="d") out_signature="d")
def get_download_rate(self): def get_download_rate(self):
"""Returns the payload download rate""" """Returns the payload download rate"""
# print self.session.status().payload_download_rate
return 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", @dbus.service.method(dbus_interface="org.deluge_torrent.Deluge",
out_signature="d") out_signature="d")