fix dht status error during startup

This commit is contained in:
Jack Robison 2019-02-01 22:12:07 -05:00
parent ba818354af
commit c3b0151943
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 2 additions and 1 deletions

View file

@ -88,6 +88,7 @@ class BlobDownloader:
if task and not task.done():
task.cancel()
await blob.close()
log.info("downloaded %s", blob_hash[:8])
return blob
except asyncio.CancelledError:
while self.active_connections:

View file

@ -349,7 +349,7 @@ class DHTComponent(Component):
async def get_status(self):
return {
'node_id': binascii.hexlify(self.dht_node.protocol.node_id),
'node_id': None if not self.dht_node else binascii.hexlify(self.dht_node.protocol.node_id),
'peers_in_routing_table': 0 if not self.dht_node else len(self.dht_node.protocol.routing_table.get_peers())
}