Fix site violation bug when using Tor

This commit is contained in:
shortcutme 2017-10-21 11:02:27 +02:00
parent ed965041e6
commit 940d583f9a
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -1027,11 +1027,14 @@ class Site(object):
def getConnectedPeers(self):
back = []
tor_manager = self.connection_server.tor_manager
for connection in self.connection_server.connections:
if not connection.connected and time.time() - connection.start_time > 20: # Still not connected after 20s
continue
peer = self.peers.get("%s:%s" % (connection.ip, connection.port))
if peer:
if connection.target_onion and tor_manager.start_onions and tor_manager.getOnion(self.address) != connection.target_onion:
continue
if not peer.connection:
peer.connect(connection)
back.append(peer)