Peers query optimize
This commit is contained in:
parent
1ec00947ad
commit
021a084796
1 changed files with 1 additions and 3 deletions
|
@ -268,9 +268,7 @@ class Site(object):
|
||||||
if self.peers:
|
if self.peers:
|
||||||
break
|
break
|
||||||
|
|
||||||
peers = self.peers.values()
|
for peer in self.peers.itervalues(): # Try to find connected good peers, but we must have at least 5 peers
|
||||||
random.shuffle(peers)
|
|
||||||
for peer in peers: # Try to find connected good peers, but we must have at least 5 peers
|
|
||||||
if peer.findConnection() and peer.connection.handshake.get("rev", 0) > 125: # Add to the beginning if rev125
|
if peer.findConnection() and peer.connection.handshake.get("rev", 0) > 125: # Add to the beginning if rev125
|
||||||
peers_try.insert(0, peer)
|
peers_try.insert(0, peer)
|
||||||
elif len(peers_try) < 5: # Backup peers, add to end of the try list
|
elif len(peers_try) < 5: # Backup peers, add to end of the try list
|
||||||
|
|
Loading…
Reference in a new issue