Handle global onion address correctly in needConnections

This commit is contained in:
shortcutme 2018-03-14 22:31:58 +01:00
parent 3561ddf7d3
commit c5f77a1c38
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -1078,8 +1078,11 @@ class Site(object):
continue continue
peer = self.peers.get("%s:%s" % (connection.ip, connection.port)) peer = self.peers.get("%s:%s" % (connection.ip, connection.port))
if peer: if peer:
if connection.target_onion and tor_manager.start_onions and tor_manager.getOnion(self.address) != connection.target_onion: if connection.ip.endswith(".onion") and connection.target_onion and tor_manager.start_onions:
continue # Check if the connection is made with the onion address created for the site
valid_target_onions = (tor_manager.getOnion(self.address), tor_manager.getOnion("global"))
if connection.target_onion not in valid_target_onions:
continue
if not peer.connection: if not peer.connection:
peer.connect(connection) peer.connect(connection)
back.append(peer) back.append(peer)