From 7048db42bd6657a0810410eb71229cae7569a632 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Fri, 15 Mar 2019 11:48:06 -0500 Subject: [PATCH] adjust expiration --- onionr/communicator.py | 3 ++- onionr/communicatorutils/onionrdaemontools.py | 11 ++++++----- onionr/onionrusers/onionrusers.py | 5 ++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/onionr/communicator.py b/onionr/communicator.py index 27753022..12fbabbc 100755 --- a/onionr/communicator.py +++ b/onionr/communicator.py @@ -101,7 +101,7 @@ class OnionrCommunicatorDaemon: 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.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.daemonTools.cooldownPeer, 30, requiresPeer=True) OnionrCommunicatorTimers(self, self.uploadBlock, 10, requiresPeer=True, maxThreads=1) @@ -122,6 +122,7 @@ class OnionrCommunicatorDaemon: peerPoolTimer.count = (peerPoolTimer.frequency - 1) cleanupTimer.count = (cleanupTimer.frequency - 60) deniableBlockTimer.count = (deniableBlockTimer.frequency - 175) + blockCleanupTimer.count = (blockCleanupTimer.frequency - 5) #forwardSecrecyTimer.count = (forwardSecrecyTimer.frequency - 990) if config.get('general.socket_servers'): diff --git a/onionr/communicatorutils/onionrdaemontools.py b/onionr/communicatorutils/onionrdaemontools.py index d2b9ef17..b68c693d 100755 --- a/onionr/communicatorutils/onionrdaemontools.py +++ b/onionr/communicatorutils/onionrdaemontools.py @@ -107,17 +107,18 @@ class DaemonTools: def cleanOldBlocks(self): '''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(): oldest = self.daemon._core.getBlockList()[0] self.daemon._core._blacklist.addToDB(oldest) self.daemon._core.removeBlock(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') def cleanKeys(self): diff --git a/onionr/onionrusers/onionrusers.py b/onionr/onionrusers/onionrusers.py index 5c85e079..e05aac0e 100755 --- a/onionr/onionrusers/onionrusers.py +++ b/onionr/onionrusers/onionrusers.py @@ -44,8 +44,8 @@ def deleteTheirExpiredKeys(coreInst, pubkey): conn.commit() conn.close() -#DEFAULT_KEY_EXPIRE = 604800 -DEFAULT_KEY_EXPIRE = 600 +DEFAULT_KEY_EXPIRE = 604800 +#DEFAULT_KEY_EXPIRE = 600 class OnionrUser: def __init__(self, coreInst, publicKey, saveUser=False): @@ -111,7 +111,6 @@ class OnionrUser: return (retData, forwardKey[0], forwardKey[1]) def forwardDecrypt(self, encrypted): - deleteExpiredKeys(self._core) retData = "" for key in self.getGeneratedForwardKeys(False): try: