improved expiry
parent
fb32201df3
commit
e1c62fee5b
|
@ -149,6 +149,11 @@ class OnionrCommunicatorDaemon:
|
|||
pass
|
||||
|
||||
logger.info('Goodbye.')
|
||||
try:
|
||||
self.service_greenlets
|
||||
except AttributeError:
|
||||
pass
|
||||
else:
|
||||
for server in self.service_greenlets:
|
||||
server.stop()
|
||||
self._core._utils.localCommand('shutdown') # shutdown the api
|
||||
|
|
|
@ -22,3 +22,4 @@ class OnionrValues:
|
|||
def __init__(self):
|
||||
self.passwordLength = 20
|
||||
self.blockMetadataLengths = {'meta': 1000, 'sig': 200, 'signer': 200, 'time': 10, 'powRandomToken': 1000, 'encryptType': 4, 'expire': 14} #TODO properly refine values to minimum needed
|
||||
self.default_expire = 2678400
|
|
@ -25,7 +25,7 @@ import onionrexceptions
|
|||
from onionr import API_VERSION
|
||||
import onionrevents
|
||||
import storagecounter
|
||||
from etc import pgpwords
|
||||
from etc import pgpwords, onionrvalues
|
||||
from onionrusers import onionrusers
|
||||
if sys.version_info < (3, 6):
|
||||
try:
|
||||
|
@ -179,8 +179,8 @@ class OnionrUtils:
|
|||
expireTime = myBlock.getHeader('expire')
|
||||
assert len(str(int(expireTime))) < 20 # test that expire time is an integer of sane length (for epoch)
|
||||
except (AssertionError, ValueError, TypeError) as e:
|
||||
pass
|
||||
else:
|
||||
expireTime = onionrvalues.OnionrValues().default_expire
|
||||
finally:
|
||||
self._core.updateBlockInfo(blockHash, 'expire', expireTime)
|
||||
if not blockType is None:
|
||||
self._core.updateBlockInfo(blockHash, 'dataType', blockType)
|
||||
|
@ -253,7 +253,7 @@ class OnionrUtils:
|
|||
pass
|
||||
|
||||
# Validate metadata dict for invalid keys to sizes that are too large
|
||||
maxAge = config.get("general.max_block_age", 2678400)
|
||||
maxAge = config.get("general.max_block_age", onionrvalues.OnionrValues().default_expire)
|
||||
if type(metadata) is dict:
|
||||
for i in metadata:
|
||||
try:
|
||||
|
@ -285,7 +285,7 @@ class OnionrUtils:
|
|||
try:
|
||||
assert int(metadata[i]) > self.getEpoch()
|
||||
except AssertionError:
|
||||
logger.warn('Block is expired: %s greater than %s' % (metadata[i], self.getEpoch()))
|
||||
logger.warn('Block is expired: %s less than %s' % (metadata[i], self.getEpoch()))
|
||||
break
|
||||
elif i == 'encryptType':
|
||||
try:
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
huei7fugyuesltkf3yzj27an36skz2f2u55g7ganyaq6yjhauwicwfyd.onion
|
|
@ -19,7 +19,7 @@
|
|||
'''
|
||||
|
||||
# Imports some useful libraries
|
||||
import locale
|
||||
import locale, sys, os
|
||||
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
|
||||
|
|
Loading…
Reference in New Issue