Skip to content

Commit

Permalink
no more Peers Source info
Browse files Browse the repository at this point in the history
** This commit dropped Peers Source info **
** Will be added in later MR **

New commit for later use:
[Tracker] Add a status for all trackers in a torrent

As part of the changes needed for a more informative trackers tab in the
UIs, we need the info for each of the trackers in the torrent.
For this, new status keys were added, and `tracker_status` is now
considered deprecated.

For tracker info, the keys are:
`trackers_status` - a dict of tracker_url->status
`trackers_peers` - a dict of tracker_url->number of peers in the tracker
  • Loading branch information
DjLegolas committed Jun 14, 2022
1 parent 387cdd8 commit 00c7c51
Showing 1 changed file with 0 additions and 60 deletions.
60 changes: 0 additions & 60 deletions deluge/core/torrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,65 +913,6 @@ def get_peers(self):

return ret

def get_peers_source(self):
"""Get the peers source statistics for this torrent.
A list of peers sources and the statistics about them.
Returns:
List: The peers source statistics.
The format for the source data::
{
"name": str,
"count" int,
"enabled": bool
}
"""
ret = []
for name in ['dht', 'pex', 'lsd']:
ret.append({'name': name, 'count': 0, 'enabled': False})

peers = self.handle.get_peer_info()

private = self.torrent_info.priv()
session_config = component.get('Core').get_config()
handle_flags = self.handle.flags()

if (
not private
and not handle_flags & lt.torrent_flags.disable_dht
and session_config['dht']
):
ret[0]['enabled'] = True
if (
not private
and not handle_flags & lt.torrent_flags.disable_pex
and session_config['utpex']
):
ret[1]['enabled'] = True
if (
not private
and not handle_flags & lt.torrent_flags.disable_lsd
and session_config['lsd']
):
ret[2]['enabled'] = True

for peer in peers:
# We do not want to report peers that are half-connected
if peer.flags & peer.connecting or peer.flags & peer.handshake:
continue

if peer.source & peer.dht:
ret[0]['count'] += 1
if peer.source & peer.pex:
ret[1]['count'] += 1
if peer.source & peer.lsd:
ret[2]['count'] += 1

return ret

def get_queue_position(self):
"""Get the torrents queue position
Expand Down Expand Up @@ -1295,7 +1236,6 @@ def _create_status_funcs(self):
'orig_files': self.get_orig_files,
'is_seed': lambda: self.status.is_seeding,
'peers': self.get_peers,
'peers_source': self.get_peers_source,
'queue': lambda: self.status.queue_position,
'ratio': self.get_ratio,
'completed_time': lambda: self.status.completed_time,
Expand Down

0 comments on commit 00c7c51

Please sign in to comment.