Rev966, New Greenlet debug hook to support Gevent 1.1.0, Publish to 8 peers on external publish request, Dont try to download banned user files, Check user files even if its own site

This commit is contained in:
HelloZeroNet 2016-03-11 12:39:39 +01:00
parent 48db062b49
commit 0897154584
7 changed files with 30 additions and 30 deletions

View file

@ -218,6 +218,9 @@ class Site(object):
content = self.content_manager.contents.get(inner_path)
if (not content or modified > content["modified"]) and inner_path not in self.bad_files:
self.log.debug("New modified file from %s: %s" % (peer, inner_path))
if inner_path != "content.json" and self.content_manager.getRules(inner_path) == False:
self.log.debug("Banned user %s: %s, skipping." % (peer, inner_path))
continue
# We dont have this file or we have older
self.bad_files[inner_path] = self.bad_files.get(inner_path, 0) + 1 # Mark as bad file
gevent.spawn(self.downloadContent, inner_path) # Download the content.json + the changed files
@ -273,10 +276,6 @@ class Site(object):
queried = self.checkModifications()
if not queried: # Not found any client that supports listModifications
self.log.debug("Fallback to old-style update")
self.redownloadContents()
self.storage.checkFiles(quick_check=True) # Quick check and mark bad files based on file size
changed, deleted = self.content_manager.loadContent("content.json")
@ -363,8 +362,8 @@ class Site(object):
threads = 5
if limit == "default":
if len(self.peers) > 50:
limit = 3
threads = 3
limit = 4
threads = 4
else:
limit = 5

View file

@ -287,7 +287,7 @@ class SiteStorage:
if not ok:
self.log.debug("[CHANGED] %s" % file_inner_path)
if add_changed:
if add_changed or content.get("cert_sign"): # If updating own site only add changed user files
bad_files.append(file_inner_path)
# Optional files
@ -338,7 +338,7 @@ class SiteStorage:
if bad_files:
for bad_file in bad_files:
self.site.bad_files[bad_file] = 1
self.log.debug("Checked files in %.2fs... Quick:%s" % (time.time() - s, quick_check))
self.log.debug("Checked files in %.2fs... Found bad files: %s, Quick:%s" % (time.time() - s, len(bad_files), quick_check))
# Delete site's all file
def deleteFiles(self):