Fix site violation bug when using Tor
This commit is contained in:
parent
ed965041e6
commit
940d583f9a
1 changed files with 3 additions and 0 deletions
|
@ -1027,11 +1027,14 @@ class Site(object):
|
||||||
|
|
||||||
def getConnectedPeers(self):
|
def getConnectedPeers(self):
|
||||||
back = []
|
back = []
|
||||||
|
tor_manager = self.connection_server.tor_manager
|
||||||
for connection in self.connection_server.connections:
|
for connection in self.connection_server.connections:
|
||||||
if not connection.connected and time.time() - connection.start_time > 20: # Still not connected after 20s
|
if not connection.connected and time.time() - connection.start_time > 20: # Still not connected after 20s
|
||||||
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:
|
||||||
|
continue
|
||||||
if not peer.connection:
|
if not peer.connection:
|
||||||
peer.connect(connection)
|
peer.connect(connection)
|
||||||
back.append(peer)
|
back.append(peer)
|
||||||
|
|
Loading…
Reference in a new issue