bug fixes and work on fs
parent
5f67cc388f
commit
0b9bb42927
|
@ -94,7 +94,7 @@ class OnionrCommunicatorDaemon:
|
||||||
OnionrCommunicatorTimers(self, self.getBlocks, self._core.config.get('timers.getBlocks'), requiresPeer=True)
|
OnionrCommunicatorTimers(self, self.getBlocks, self._core.config.get('timers.getBlocks'), requiresPeer=True)
|
||||||
OnionrCommunicatorTimers(self, self.clearOfflinePeer, 58)
|
OnionrCommunicatorTimers(self, self.clearOfflinePeer, 58)
|
||||||
OnionrCommunicatorTimers(self, self.daemonTools.cleanOldBlocks, 65)
|
OnionrCommunicatorTimers(self, self.daemonTools.cleanOldBlocks, 65)
|
||||||
OnionrCommunicatorTimers(self, self.lookupKeys, 60, requiresPeer=True)
|
#OnionrCommunicatorTimers(self, self.lookupKeys, 60, requiresPeer=True)
|
||||||
OnionrCommunicatorTimers(self, self.lookupAdders, 60, requiresPeer=True)
|
OnionrCommunicatorTimers(self, self.lookupAdders, 60, requiresPeer=True)
|
||||||
OnionrCommunicatorTimers(self, self.daemonTools.cooldownPeer, 30, requiresPeer=True)
|
OnionrCommunicatorTimers(self, self.daemonTools.cooldownPeer, 30, requiresPeer=True)
|
||||||
netCheckTimer = OnionrCommunicatorTimers(self, self.daemonTools.netCheck, 600)
|
netCheckTimer = OnionrCommunicatorTimers(self, self.daemonTools.netCheck, 600)
|
||||||
|
|
|
@ -228,7 +228,7 @@ class Block:
|
||||||
blockFile.write(self.getRaw().encode())
|
blockFile.write(self.getRaw().encode())
|
||||||
self.update()
|
self.update()
|
||||||
else:
|
else:
|
||||||
self.hash = self.getCore().insertBlock(self.getContent(), header = self.getType(), sign = sign)
|
self.hash = self.getCore().insertBlock(self.getContent(), header = self.getType(), sign = sign, expire=self.getExpire())
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
return self.getHash()
|
return self.getHash()
|
||||||
|
@ -241,6 +241,15 @@ class Block:
|
||||||
|
|
||||||
# getters
|
# getters
|
||||||
|
|
||||||
|
def getExpire(self):
|
||||||
|
'''
|
||||||
|
Returns the expire time for a block
|
||||||
|
|
||||||
|
Outputs:
|
||||||
|
- (int): the expire time for a block, or None
|
||||||
|
'''
|
||||||
|
return self.expire
|
||||||
|
|
||||||
def getHash(self):
|
def getHash(self):
|
||||||
'''
|
'''
|
||||||
Returns the hash of the block if saved to file
|
Returns the hash of the block if saved to file
|
||||||
|
|
|
@ -372,7 +372,12 @@ class OnionrUtils:
|
||||||
logger.warn('Block has invalid metadata key ' + i)
|
logger.warn('Block has invalid metadata key ' + i)
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
if self._core.requirements.blockMetadataLengths[i] < len(metadata[i]):
|
testData = metadata[i]
|
||||||
|
try:
|
||||||
|
testData = len(testData)
|
||||||
|
except (TypeError, AttributeError) as e:
|
||||||
|
testData = len(str(testData))
|
||||||
|
if self._core.requirements.blockMetadataLengths[i] < testData:
|
||||||
logger.warn('Block metadata key ' + i + ' exceeded maximum size')
|
logger.warn('Block metadata key ' + i + ' exceeded maximum size')
|
||||||
break
|
break
|
||||||
if i == 'time':
|
if i == 'time':
|
||||||
|
|
|
@ -45,9 +45,9 @@ class OnionrFlow:
|
||||||
self.flowRunning = False
|
self.flowRunning = False
|
||||||
if message == "q":
|
if message == "q":
|
||||||
self.flowRunning = False
|
self.flowRunning = False
|
||||||
|
expireTime = self.myCore._utils.getEpoch() + 43200
|
||||||
if len(message) > 0:
|
if len(message) > 0:
|
||||||
Block(content = message, type = 'txt', core = self.myCore).save()
|
Block(content = message, type = 'txt', expire=expireTime, core = self.myCore).save()
|
||||||
|
|
||||||
logger.info("Flow is exiting, goodbye")
|
logger.info("Flow is exiting, goodbye")
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue