mirror of
https://github.com/HelloZeroNet/ZeroNet.git
synced 2023-12-14 04:33:03 +01:00
Merge 0a5065c9c2
into eec0b22c1f
This commit is contained in:
commit
1a31ebe4c2
|
@ -595,11 +595,29 @@ class Site:
|
|||
announced = 0
|
||||
threads = []
|
||||
|
||||
for protocol, ip, port in SiteManager.TRACKERS: # Start announce threads
|
||||
thread = gevent.spawn(self.announceTracker, protocol, ip, port, fileserver_port, address_hash, my_peer_id)
|
||||
threads.append(thread)
|
||||
thread.ip = ip
|
||||
thread.protocol = protocol
|
||||
# read bootstrap nodes
|
||||
nodes_filename="bootstrap"
|
||||
if os.path.isfile(nodes_filename):
|
||||
bootstrap_nodes = open(nodes_filename,"r")
|
||||
for node in bootstrap_nodes:
|
||||
node_fields = node.split(' ')
|
||||
if len(node_fields) == 3:
|
||||
protocol = node_fields[0].strip().lower()
|
||||
ip = node_fields[1].strip()
|
||||
port = None
|
||||
if node_fields[2].strip().lower() != "none":
|
||||
port = int(node_fields[2].strip())
|
||||
thread = gevent.spawn(self.announceTracker, protocol, ip, port, fileserver_port, address_hash, my_peer_id)
|
||||
threads.append(thread)
|
||||
thread.ip = ip
|
||||
thread.protocol = protocol
|
||||
|
||||
if not threads:
|
||||
for protocol, ip, port in SiteManager.TRACKERS: # Start announce threads
|
||||
thread = gevent.spawn(self.announceTracker, protocol, ip, port, fileserver_port, address_hash, my_peer_id)
|
||||
threads.append(thread)
|
||||
thread.ip = ip
|
||||
thread.protocol = protocol
|
||||
|
||||
gevent.joinall(threads) # Wait for announce finish
|
||||
|
||||
|
|
Loading…
Reference in a new issue