mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-07 00:48:41 +00:00
Fix add_torrent_url() to download the torrent file in a thread to
prevent the main thread from blocking and causing the daemon to freeze.
This commit is contained in:
parent
c2427ccb7d
commit
56b806ce78
3 changed files with 12 additions and 8 deletions
|
@ -3,6 +3,8 @@ Deluge 1.0.1 (In Development)
|
||||||
* Change the default max global upload slots to 4 instead of -1 since libtorrent
|
* Change the default max global upload slots to 4 instead of -1 since libtorrent
|
||||||
will automatically open more slots to meet the upload speed limit.
|
will automatically open more slots to meet the upload speed limit.
|
||||||
* Fix display of tracker error messages
|
* Fix display of tracker error messages
|
||||||
|
* Fix add_torrent_url() to download the torrent file in a thread to prevent
|
||||||
|
the main thread from blocking and causing the daemon to freeze.
|
||||||
|
|
||||||
GtkUI:
|
GtkUI:
|
||||||
* Improve performance of files tab by only updating when values change
|
* Improve performance of files tab by only updating when values change
|
||||||
|
|
|
@ -396,9 +396,12 @@ class Core(
|
||||||
# Run the plugin hooks for 'post_torrent_add'
|
# Run the plugin hooks for 'post_torrent_add'
|
||||||
self.plugins.run_post_torrent_add(torrent_id)
|
self.plugins.run_post_torrent_add(torrent_id)
|
||||||
|
|
||||||
def export_add_torrent_url(self, url, save_path, options):
|
def export_add_torrent_url(self, url, options):
|
||||||
log.info("Attempting to add url %s", url)
|
log.info("Attempting to add url %s", url)
|
||||||
|
|
||||||
|
threading.Thread(target=self.fetch_torrent_url_thread, args=(self.export_add_torrent_file, url, options)).start()
|
||||||
|
|
||||||
|
def fetch_torrent_url_thread(self, callback, url, options):
|
||||||
# Get the actual filename of the torrent from the url provided.
|
# Get the actual filename of the torrent from the url provided.
|
||||||
filename = url.split("/")[-1]
|
filename = url.split("/")[-1]
|
||||||
|
|
||||||
|
@ -415,8 +418,7 @@ class Core(
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Add the torrent to session
|
# Add the torrent to session
|
||||||
return self.export_add_torrent_file(
|
return callback(filename, filedump, options)
|
||||||
filename, filedump, options)
|
|
||||||
|
|
||||||
def export_remove_torrent(self, torrent_ids, remove_torrent, remove_data):
|
def export_remove_torrent(self, torrent_ids, remove_torrent, remove_data):
|
||||||
log.debug("Removing torrent %s from the core.", torrent_ids)
|
log.debug("Removing torrent %s from the core.", torrent_ids)
|
||||||
|
|
|
@ -119,7 +119,7 @@ class torrent_add:
|
||||||
return
|
return
|
||||||
|
|
||||||
if vars.url:
|
if vars.url:
|
||||||
proxy.add_torrent_url(vars.url, None,options)
|
proxy.add_torrent_url(vars.url, options)
|
||||||
log.debug("add-url:options :%s" % options)
|
log.debug("add-url:options :%s" % options)
|
||||||
self.redirect(vars.choose_files)
|
self.redirect(vars.choose_files)
|
||||||
elif torrent_name:
|
elif torrent_name:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue