add Node.contacts helper property

This commit is contained in:
Jack Robison 2017-10-10 13:28:57 -04:00
parent 23ce278f8a
commit 5937ead17c
No known key found for this signature in database
GPG key ID: 284699E7404E3CFF

View file

@ -171,6 +171,14 @@ class Node(object):
self.hash_watcher.tick()
yield self._joinDeferred
@property
def contacts(self):
def _inner():
for i in range(len(self._routingTable._buckets)):
for contact in self._routingTable._buckets[i]._contacts:
yield contact
return list(_inner())
def printContacts(self, *args):
print '\n\nNODE CONTACTS\n==============='
for i in range(len(self._routingTable._buckets)):