adjust expiration

This commit is contained in:
Kevin Froman 2019-03-15 11:48:06 -05:00
parent 59cc7709d9
commit 7048db42bd
3 changed files with 10 additions and 9 deletions

View File

@ -101,7 +101,7 @@ class OnionrCommunicatorDaemon:
OnionrCommunicatorTimers(self, self.lookupBlocks, self._core.config.get('timers.lookupBlocks'), requiresPeer=True, maxThreads=1) OnionrCommunicatorTimers(self, self.lookupBlocks, self._core.config.get('timers.lookupBlocks'), requiresPeer=True, maxThreads=1)
OnionrCommunicatorTimers(self, self.getBlocks, self._core.config.get('timers.getBlocks'), requiresPeer=True, maxThreads=2) OnionrCommunicatorTimers(self, self.getBlocks, self._core.config.get('timers.getBlocks'), requiresPeer=True, maxThreads=2)
OnionrCommunicatorTimers(self, self.clearOfflinePeer, 58) OnionrCommunicatorTimers(self, self.clearOfflinePeer, 58)
OnionrCommunicatorTimers(self, self.daemonTools.cleanOldBlocks, 65) blockCleanupTimer = OnionrCommunicatorTimers(self, self.daemonTools.cleanOldBlocks, 65)
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)
OnionrCommunicatorTimers(self, self.uploadBlock, 10, requiresPeer=True, maxThreads=1) OnionrCommunicatorTimers(self, self.uploadBlock, 10, requiresPeer=True, maxThreads=1)
@ -122,6 +122,7 @@ class OnionrCommunicatorDaemon:
peerPoolTimer.count = (peerPoolTimer.frequency - 1) peerPoolTimer.count = (peerPoolTimer.frequency - 1)
cleanupTimer.count = (cleanupTimer.frequency - 60) cleanupTimer.count = (cleanupTimer.frequency - 60)
deniableBlockTimer.count = (deniableBlockTimer.frequency - 175) deniableBlockTimer.count = (deniableBlockTimer.frequency - 175)
blockCleanupTimer.count = (blockCleanupTimer.frequency - 5)
#forwardSecrecyTimer.count = (forwardSecrecyTimer.frequency - 990) #forwardSecrecyTimer.count = (forwardSecrecyTimer.frequency - 990)
if config.get('general.socket_servers'): if config.get('general.socket_servers'):

View File

@ -107,17 +107,18 @@ class DaemonTools:
def cleanOldBlocks(self): def cleanOldBlocks(self):
'''Delete old blocks if our disk allocation is full/near full, and also expired blocks''' '''Delete old blocks if our disk allocation is full/near full, and also expired blocks'''
# Delete expired blocks
for bHash in self.daemon._core.getExpiredBlocks():
self.daemon._core._blacklist.addToDB(bHash)
self.daemon._core.removeBlock(bHash)
logger.info('Deleted block: %s' % (bHash,))
while self.daemon._core._utils.storageCounter.isFull(): while self.daemon._core._utils.storageCounter.isFull():
oldest = self.daemon._core.getBlockList()[0] oldest = self.daemon._core.getBlockList()[0]
self.daemon._core._blacklist.addToDB(oldest) self.daemon._core._blacklist.addToDB(oldest)
self.daemon._core.removeBlock(oldest) self.daemon._core.removeBlock(oldest)
logger.info('Deleted block: %s' % (oldest,)) logger.info('Deleted block: %s' % (oldest,))
# Delete expired blocks
for bHash in self.daemon._core.getExpiredBlocks():
self.daemon._core._blacklist.addToDB(bHash)
self.daemon._core.removeBlock(bHash)
self.daemon.decrementThreadCount('cleanOldBlocks') self.daemon.decrementThreadCount('cleanOldBlocks')
def cleanKeys(self): def cleanKeys(self):

View File

@ -44,8 +44,8 @@ def deleteTheirExpiredKeys(coreInst, pubkey):
conn.commit() conn.commit()
conn.close() conn.close()
#DEFAULT_KEY_EXPIRE = 604800 DEFAULT_KEY_EXPIRE = 604800
DEFAULT_KEY_EXPIRE = 600 #DEFAULT_KEY_EXPIRE = 600
class OnionrUser: class OnionrUser:
def __init__(self, coreInst, publicKey, saveUser=False): def __init__(self, coreInst, publicKey, saveUser=False):
@ -111,7 +111,6 @@ class OnionrUser:
return (retData, forwardKey[0], forwardKey[1]) return (retData, forwardKey[0], forwardKey[1])
def forwardDecrypt(self, encrypted): def forwardDecrypt(self, encrypted):
deleteExpiredKeys(self._core)
retData = "" retData = ""
for key in self.getGeneratedForwardKeys(False): for key in self.getGeneratedForwardKeys(False):
try: try: