No positive preference for peers with more than 5 shared sites to avoid centralization

This commit is contained in:
shortcutme 2017-04-09 11:57:35 +02:00
parent 6c8a7e3cfa
commit 16bfb35109
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 1 additions and 1 deletions

View File

@ -979,7 +979,7 @@ class Site(object):
need_to_close = len(connected_peers) - config.connected_limit
if closed < need_to_close:
for peer in sorted(connected_peers, key=lambda peer: peer.connection.sites): # Try to keep connections with more sites
for peer in sorted(connected_peers, key=lambda peer: min(peer.connection.sites, 5)): # Try to keep connections with more sites
if not peer.connection:
continue
if peer.connection.sites > 5: