when looking up peers, only return one instance of each peer

This commit is contained in:
Jimmy Kiselak 2015-08-31 11:14:25 -04:00
parent 7e4f36e8b4
commit 0506dfba10

View file

@ -32,8 +32,9 @@ class DHTPeerFinder(object):
bin_hash = binascii.unhexlify(blob_hash) bin_hash = binascii.unhexlify(blob_hash)
def filter_peers(peer_list): def filter_peers(peer_list):
peers = set(peer_list)
good_peers = [] good_peers = []
for host, port in peer_list: for host, port in peers:
peer = self.peer_manager.get_peer(host, port) peer = self.peer_manager.get_peer(host, port)
if peer.is_available() is True: if peer.is_available() is True:
good_peers.append(peer) good_peers.append(peer)