total object stat, proper zeronet updater timeout catch, connection using connectionserver logger, trigger sitestorage onupdated when signing new file, named once events, only publish once same updated files, retry bad files every 20 min, trigger connection error on failed connection

This commit is contained in:
HelloZeroNet 2015-04-08 01:57:55 +02:00
parent d361f66362
commit 67783bd494
12 changed files with 130 additions and 58 deletions

View file

@ -63,7 +63,7 @@ class FileRequest:
if params["inner_path"].endswith("content.json"): # Download every changed file from peer
peer = site.addPeer(*params["peer"], return_peer = True) # Add or get peer
site.onComplete.once(lambda: site.publish(inner_path=params["inner_path"])) # On complete publish to other peers
site.onComplete.once(lambda: site.publish(inner_path=params["inner_path"]), "publish_%s" % params["inner_path"]) # On complete publish to other peers
gevent.spawn(
lambda: site.downloadContent(params["inner_path"], peer=peer)
) # Load new content file and download changed files in new thread

View file

@ -129,6 +129,10 @@ class FileServer(ConnectionServer):
for inner_path in site.bad_files:
site.bad_files[inner_path] = 0
# Retry failed files
if site.bad_files:
site.retryBadFiles()
# In passive mode keep 5 active peer connection to get the updates
if self.port_opened == False:
site.needConnections()
@ -152,7 +156,7 @@ class FileServer(ConnectionServer):
# Bind and start serving sites
def start(self, check_sites = True):
self.log = logging.getLogger(__name__)
self.log = logging.getLogger("FileServer")
if config.debug:
# Auto reload FileRequest on change