Make shutdown() an async method.

This commit is contained in:
Andrew Resch 2007-09-24 08:22:02 +00:00
parent 67347e67b6
commit cf116cf3a1
1 changed files with 11 additions and 6 deletions

View File

@ -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
@ -162,6 +160,14 @@ class Core(dbus.service.Object):
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")
def add_torrent_file(self, filename, filedump):
@ -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")