Add number of dht peers to debug info

pull/1/head
Gorka Olaizola 2015-10-18 10:47:38 +02:00
parent 72390ffb82
commit 1eb844d7e5
1 changed files with 7 additions and 1 deletions

View File

@ -530,7 +530,13 @@ class Libtorrent:
result=result+'Trackers: verified %d/%d, fails=%d' %(verified_sum, len(trackers)-1, fails_sum)
if info=='dht_state':
is_dht_running='ON' if self.session.is_dht_running() else 'OFF'
nodes=0
dht_state = self.session.dht_state()
if 'nodes' in dht_state:
nodes = len(dht_state['nodes'])
else:
nodes=0
result='DHT: %s (%d)' % (is_dht_running, nodes)
return result