The “peers” tab for a given selected torrent in Deluge is rather scarce of information. By default it only displays:
- Country
- Address
- Client
- Progress
- Download Speed
- Upload Speed
I want more information – especially the flags (as uTorrent displays, or as close to).
So here are instructions on what to modify in order to get more information about peers displayed.
Firstly you may want to pin the deluge packages on your Linux/Ubuntu host to prevent them from being upgraded in the future (and wipe out your modifications):
me@host:~$ sudo apt-mark hold deluged
me@host:~$ sudo apt-mark hold deluge-web
me@host:~$ sudo apt-mark hold deluge-common
Edit the file torrent.py so that it returns more fields in the AJAX response to the query from the browser for peer detail to modify the get_peers() function to add the following lines:
peerflags = str()
if peer.flags & peer.snubbed:
peerflags += "S"
if peer.flags & peer.interesting:
if not peer.flags & peer.remote_choked:
peerflags += "D"
else:
peerflags += "d"
elif not peer.flags & peer.remote_choked:
peerflags += "K"
if peer.flags & peer.remote_interested:
if not peer.flags & peer.choked:
peerflags += "U"
else:
peerflags += "u"
elif not peer.flags & peer.choked:
peerflags += "?"
if peer.flags & peer.rc4_encrypted:
peerflags += "E"
if peer.flags & peer.plaintext_encrypted:
peerflags += "e"
if peer.flags & peer.optimistic_unchoke:
peerflags += "O"
if not peer.flags & peer.local_connection:
peerflags += "I"
if peer.flags & peer.endgame_mode:
peerflags += "g"
if peer.flags & peer.holepunched:
peerflags += "h"
#if peer.flags & peer.utp_socket:
# peerflags += "P"
if peer.num_hashfails > 0:
peerflags += "F"
if peer.source & peer.dht:
peerflags += "H"
if peer.source & peer.pex:
peerflags += "X"
if peer.source & peer.lsd:
peerflags += "L"
if peer.source & peer.tracker:
peerflags += "T"
ret.append({
"client": client,
"country": country,
"down_speed": peer.payload_down_speed,
"ip": "%s:%s" % (peer.ip[0], peer.ip[1]),
"progress": peer.progress,
"seed": peer.flags & peer.seed,
"up_speed": peer.payload_up_speed,
"flags": peerflags,
"total_download": peer.total_download,
"total_upload": peer.total_upload,
"rtt": peer.rtt,
})
Next edit line 224 of the JavaScript file deluge-all.js to add the highlighted lines (but you may want to keep it all squashed up in one line in the file, it doesn’t matter):
...
function c(e){...}
function ms(e){return String.format('{0}ms',e);}
Deluge.details.PeersTab=...
...
{header:"Up Speed",width:100,sortable:true,renderer:fspeed,dataIndex:"up_speed"},
{header:"Flags",width:70,sortable:true,renderer:fplain,dataIndex:"flags"},
{header:"Downloaded",width:100,sortable:true,renderer:fsize,dataIndex:"total_download"},
{header:"Uploaded",width:100,sortable:true,renderer:fsize,dataIndex:"total_upload"},
{header:"RTT",width:70,sortable:true,renderer:ms,dataIndex:"rtt"}
],
So what do the flags mean?
- S – peer snubbed
- D – peer has what we want and remote not choked (usually downloading)
- d – peer has what we want but remote is choked (want to download but they won’t)
- K – peer doesn’t have what we want but isn’t choking us
- U – peer wants what we have and we are not choked (usually uploading)
- u – peer wants what we have and we are choked (peer wants us to upload but we won’t)
- ? – peer doesn’t want what we have but we’re not choking them
- E – RC4 (connection) encrypted
- e – plaintext (handshake) encrypted
- O – optimistic unchoke
- I – incoming connection (peer initiated connection to us)
- g – endgame mode
- h – peer holepunched
- P – uTP socket (flag not present in older versions of libtorrent)
- F – peer has participated in a piece that failed hash
- H – peer found via DHT
- X – peer found via PEX
- L – peer found via local service discovery (on local network)
- T – peer found via tracker
See the peer_info structure in libtorrent for more detail.
Recent Comments