Pass diffs to other users

This commit is contained in:
HelloZeroNet 2016-04-06 13:59:53 +02:00
parent 7c3e470ea7
commit 82b960c641
2 changed files with 7 additions and 4 deletions

View file

@ -101,11 +101,11 @@ class FileRequest(object):
if params["inner_path"].endswith("content.json"): # Download every changed file from peer
peer = site.addPeer(self.connection.ip, self.connection.port, return_peer=True) # Add or get peer
# On complete publish to other peers
site.onComplete.once(lambda: site.publish(inner_path=params["inner_path"]), "publish_%s" % params["inner_path"])
site.onComplete.once(lambda: site.publish(inner_path=params["inner_path"], diffs=params.get("diffs", {})), "publish_%s" % params["inner_path"])
# Load new content file and download changed files in new thread
gevent.spawn(
lambda: site.downloadContent(params["inner_path"], peer=peer)
lambda: site.downloadContent(params["inner_path"], peer=peer, diffs=params.get("diffs", {}))
)
self.response({"ok": "Thanks, file %s updated!" % params["inner_path"]})