# HG changeset patch # User Laman # Date 2018-01-24 10:58:18 # Node ID 4f3ff4c311f2e1becf7cd4f807c2a36663bfd5c3 # Parent 87a9ced6e7b5965077373939e715a83e0a380333 bugfix: server failed to update its stored tree diff --git a/src/config.py b/src/config.py --- a/src/config.py +++ b/src/config.py @@ -21,7 +21,7 @@ conf=dict() if os.path.isfile(configFile): with open(configFile) as f: conf=json.load(f) -version=[0,1,0] +version=[0,1,1] lowestCompatible=[0,1,0] # tuple is more fitting but json conversion transforms it into a list anyway hosts=conf.get("hosts",["127.0.0.1"]) diff --git a/src/server.py b/src/server.py --- a/src/server.py +++ b/src/server.py @@ -137,10 +137,11 @@ class Server(NetNode): for (i,k) in enumerate(indices): if self._lastIndex+1!=k: self._dataFile.seek(k*self.BLOCK_SIZE) - self._dataFile.write(binData[i*self.BLOCK_SIZE:(i+1)*self.BLOCK_SIZE]) + block=binData[i*self.BLOCK_SIZE:(i+1)*self.BLOCK_SIZE] + self._dataFile.write(block) self._lastIndex=k if self._treeFile: - self._newLeaves[k+self._tree.leafStart]=hashBlock(binData) + self._newLeaves[k+self._tree.leafStart]=hashBlock(block) return ({"command": "ack", "index": indices},)