Skip to content

Commit

Permalink
Merge pull request #5875 from drew2a/fix/5740
Browse files Browse the repository at this point in the history
Fix #5740
  • Loading branch information
drew2a committed Dec 22, 2020
2 parents 7562d25 + 45ce253 commit 8086fd9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/tribler-core/tribler_core/modules/libtorrent/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,15 @@ def on_tracker_reply_alert(self, alert):
self.tracker_status[alert.url] = [alert.num_peers, 'Working']

def on_tracker_error_alert(self, alert):
peers = self.tracker_status[alert.url][0] if alert.url in self.tracker_status else 0
# try-except block here is a workaround and has been added to solve
# https://github.com/Tribler/tribler/issues/5740
try:
url = alert.url
except UnicodeDecodeError as e:
self._logger.exception(e)
return

peers = self.tracker_status[url][0] if url in self.tracker_status else 0
if alert.msg:
status = 'Error: ' + alert.msg
elif alert.status_code > 0:
Expand All @@ -308,7 +316,7 @@ def on_tracker_error_alert(self, alert):
else:
status = 'Not working'

self.tracker_status[alert.url] = [peers, status]
self.tracker_status[url] = [peers, status]

def on_tracker_warning_alert(self, alert):
peers = self.tracker_status[alert.url][0] if alert.url in self.tracker_status else 0
Expand Down

0 comments on commit 8086fd9

Please sign in to comment.