Rev390, Fix sidebar error on non locatable IPs, Configurable bootstrap torrent trackers, Multi-line config file settings, Evenly distributed tracker announce to work better on passive connections, Avoid iframe sandbox escape by using nonces, Better html error messages, Display proper error on invalid startup parameters

This commit is contained in:
HelloZeroNet 2015-09-10 23:25:09 +02:00
parent eec0b22c1f
commit 0de6496f96
11 changed files with 117 additions and 58 deletions

View file

@ -170,11 +170,15 @@ class FileServer(ConnectionServer):
# Announce sites every 20 min
def announceSites(self):
import gc
first_announce = True # First start
while 1:
time.sleep(20 * 60) # Announce sites every 20 min
# Sites healthcare
for address, site in self.sites.items():
if site.settings["serving"]:
site.announce() # Announce site to tracker
if first_announce: # Announce to all trackers on startup
site.announce()
else: # If not first run only use PEX
site.announcePex()
# Reset bad file retry counter
for inner_path in site.bad_files:
@ -195,6 +199,20 @@ class FileServer(ConnectionServer):
site = None
gc.collect() # Implicit grabage collection
# Find new peers
for tracker_i in range(len(config.trackers)):
time.sleep(60 * 20 / len(config.trackers)) # Query all trackers one-by-one in 20 minutes evenly distributed
for address, site in self.sites.items():
site.announce(num = 1, pex = False)
time.sleep(2)
first_announce = False
# Detects if computer back from wakeup
def wakeupWatcher(self):
last_time = time.time()