Changeset - 1751c1b9b3d9
[Not reviewed]
Merge default
0 2 0
Laman - 7 years ago 2018-01-24 11:00:59

merged bugfix
2 files changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/config.py
Show inline comments
 
@@ -18,13 +18,13 @@ peers=os.path.join(directory,"certs/peer
 

	
 
configFile=os.path.join(directory,"config.json")
 
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"])
 
port=conf.get("port",9901)
 

	
 
bSize=conf.get("batchSize",dict())
src/server.py
Show inline comments
 
@@ -136,16 +136,17 @@ class Server(NetNode):
 
		log.info("received data block #{0}: {1}...{2}".format(jsonData["index"],binData[:5],binData[-5:]))
 

	
 
		indices=jsonData["index"]
 
		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},)
 

	
 
	def _finalize(self):
 
		log.info("closing session...")
 
		self._dataFile.close()
0 comments (0 inline, 0 general)