diff --git a/src/Config.py b/src/Config.py index 857a177a..add6099d 100644 --- a/src/Config.py +++ b/src/Config.py @@ -10,7 +10,7 @@ class Config(object): def __init__(self, argv): self.version = "0.5.3" - self.rev = 2023 + self.rev = 2025 self.argv = argv self.action = None self.config_file = "zeronet.conf" diff --git a/src/Site/Site.py b/src/Site/Site.py index 424855b8..cddef0fe 100644 --- a/src/Site/Site.py +++ b/src/Site/Site.py @@ -303,11 +303,16 @@ class Site(object): modified_contents = [] my_modified = self.content_manager.listModified(since) for inner_path, modified in res["modified_files"].iteritems(): # Check if the peer has newer files than we - newer = int(modified) > my_modified.get(inner_path, 0) - if newer and inner_path not in self.bad_files and not self.content_manager.isArchived(inner_path, modified): - # We dont have this file or we have older - modified_contents.append(inner_path) - self.bad_files[inner_path] = self.bad_files.get(inner_path, 0) + 1 + has_newer = int(modified) > my_modified.get(inner_path, 0) + has_older = int(modified) < my_modified.get(inner_path, 0) + if inner_path not in self.bad_files and not self.content_manager.isArchived(inner_path, modified): + if has_newer: + # We dont have this file or we have older + modified_contents.append(inner_path) + self.bad_files[inner_path] = self.bad_files.get(inner_path, 0) + 1 + if has_older: + self.log.debug("%s client has older version of %s, publishing there..." % (peer, inner_path)) + gevent.spawn(self.publisher, inner_path, [peer], [], 1) if modified_contents: self.log.debug("%s new modified file from %s" % (len(modified_contents), peer)) modified_contents.sort(key=lambda inner_path: 0 - res["modified_files"][inner_path]) # Download newest first