Rev597, Dont load content.json if the modified date is same, Big content.json memory optimalzations, Peerhashfield memory optimalzations and typo fix, Give up on file after 10 retry, Fix non-ascii install paths, Stop worker after 10 connection error

This commit is contained in:
HelloZeroNet 2015-11-15 11:13:57 +01:00
parent 7f05e96f05
commit 3d558a4edf
6 changed files with 26 additions and 9 deletions

View file

@ -2,12 +2,13 @@ import array
import time
class PeerHashfield:
class PeerHashfield(object):
__slots__ = ("storage", "time_changed", "append", "remove", "tostring", "fromstring", "__len__", "__iter__")
def __init__(self):
self.storage = self.createStoreage()
self.storage = self.createStorage()
self.time_changed = time.time()
def createStoreage(self):
def createStorage(self):
storage = array.array("H")
self.append = storage.append
self.remove = storage.remove
@ -50,7 +51,7 @@ class PeerHashfield:
return int(hash[0:4], 16) in self.storage
def replaceFromString(self, hashfield_raw):
self.storage = self.createStoreage()
self.storage = self.createStorage()
self.storage.fromstring(hashfield_raw)
self.time_changed = time.time()