Version 0.2.9, Only send peers over pex that worked within 2 hours, Mark peer as bad on publish 5sec timeout, Starting typo fix, Only ask peers from 2 sources every 20 min, Maybe fixed notification icon crashing

This commit is contained in:
HelloZeroNet 2015-04-15 23:33:21 +02:00
parent 30281c8fb5
commit 6e081d95f5
7 changed files with 45 additions and 20 deletions

View file

@ -132,9 +132,7 @@ class FileRequest:
got_peer_keys.append("%s:%s" % address)
if (site.addPeer(*address)): added += 1
# Send back peers that is not in the sent list and connectable (not port 0)
peers = site.peers.values()
random.shuffle(peers)
packed_peers = [peer.packAddress() for peer in peers if not peer.key.endswith(":0") and peer.key not in got_peer_keys][0:params["need"]]
packed_peers = [peer.packAddress() for peer in site.getConnectablePeers(params["need"], got_peer_keys)]
if added:
self.log.debug("Added %s peers to %s using pex, sending back %s" % (added, site, len(packed_peers)))
self.response({"peers": packed_peers})