summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--deluge/core/torrent.py2
-rw-r--r--deluge/core/torrentmanager.py28
2 files changed, 27 insertions, 3 deletions
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
index 1676ff6ca..9dc2d4163 100644
--- a/deluge/core/torrent.py
+++ b/deluge/core/torrent.py
@@ -994,6 +994,8 @@ class Torrent(object):
call to get_status based on the session_id
update (bool): If True the status will be updated from libtorrent
if False, the cached values will be returned
+ all_keys (bool): If True return all keys while ignoring the keys param
+ if False, return only the requested keys
Returns:
dict: a dictionary of the status keys and their values
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
index b94868776..7ad837bbe 100644
--- a/deluge/core/torrentmanager.py
+++ b/deluge/core/torrentmanager.py
@@ -24,8 +24,15 @@ from twisted.internet.defer import Deferred, DeferredList
from twisted.internet.task import LoopingCall
import deluge.component as component
-from deluge._libtorrent import lt
-from deluge.common import PY2, archive_files, decode_bytes, get_magnet_info, is_magnet
+from deluge._libtorrent import LT_VERSION, lt
+from deluge.common import (
+ PY2,
+ VersionSplit,
+ archive_files,
+ decode_bytes,
+ get_magnet_info,
+ is_magnet,
+)
from deluge.configmanager import ConfigManager, get_config_dir
from deluge.core.authmanager import AUTH_LEVEL_ADMIN
from deluge.core.torrent import Torrent, TorrentOptions, sanitize_filepath
@@ -1392,7 +1399,22 @@ class TorrentManager(component.Component):
log.debug(
'Tracker Error Alert: %s [%s]', decode_bytes(alert.message()), error_message
)
- torrent.set_tracker_status('Error: ' + error_message)
+ if VersionSplit(LT_VERSION) >= VersionSplit('1.2.0.0'):
+ # libtorrent 1.2 added endpoint struct to each tracker. to prevent false updates
+ # we will need to verify that at least one endpoint to the errored tracker is working
+ for tracker in torrent.handle.trackers():
+ if tracker['url'] == alert.url:
+ if any(
+ endpoint['last_error']['value'] == 0
+ for endpoint in tracker['endpoints']
+ ):
+ torrent.set_tracker_status('Announce OK')
+ else:
+ torrent.set_tracker_status('Error: ' + error_message)
+ break
+ else:
+ # preserve old functionality for libtorrent < 1.2
+ torrent.set_tracker_status('Error: ' + error_message)
def on_alert_storage_moved(self, alert):
"""Alert handler for libtorrent storage_moved_alert"""