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
1 changed files with 5 additions and 2 deletions

View File

@ -1078,8 +1078,11 @@ class Site(object):
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 connection.ip.endswith(".onion") and connection.target_onion and tor_manager.start_onions:
# 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:
peer.connect(connection)
back.append(peer)