File tree 1 file changed +5
-1
lines changed
src/tribler/core/components/libtorrent/download_manager
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -312,13 +312,16 @@ def on_tracker_reply_alert(self, alert: lt.tracker_reply_alert):
312
312
self .tracker_status [alert .url ] = [alert .num_peers , 'Working' ]
313
313
314
314
def on_tracker_error_alert (self , alert : lt .tracker_error_alert ):
315
+ """
316
+ This alert is generated on tracker timeouts, premature disconnects, invalid response
317
+ or an HTTP response other than "200 OK". - From Libtorrent documentation.
318
+ """
315
319
# The try-except block is added as a workaround to suppress UnicodeDecodeError in `repr(alert)`,
316
320
# `alert.url` and `alert.msg`. See https://github.com/arvidn/libtorrent/issues/143
317
321
try :
318
322
self ._logger .error (f'On tracker error alert: { alert } ' )
319
323
url = alert .url
320
324
321
- peers = self .tracker_status [url ][0 ] if url in self .tracker_status else 0
322
325
if alert .msg :
323
326
status = 'Error: ' + alert .msg
324
327
elif alert .status_code > 0 :
@@ -328,6 +331,7 @@ def on_tracker_error_alert(self, alert: lt.tracker_error_alert):
328
331
else :
329
332
status = 'Not working'
330
333
334
+ peers = 0 # If there is a tracker error, alert.num_peers is not available. So resetting peer count to zero.
331
335
self .tracker_status [url ] = [peers , status ]
332
336
except UnicodeDecodeError as e :
333
337
self ._logger .warning (f'UnicodeDecodeError in on_tracker_error_alert: { e } ' )
You can’t perform that action at this time.
0 commit comments